I successfully used the SAS to Table conversion tool for a recent project. From the original multi-sheet Excel dataset I was working with, I created three tables in SAS: one for the nation, one for states, and one for metro areas. After doing the tabular data transformation, I was ready to read these three tables into ArcGIS Pro and join to boundaries.
The SAS to Table conversion tool preserved my field lengths, field types, and field labels I set in my SAS tables, all things that need to be re-applied when exporting and importing a CSV file. This blog post offers tips to help you be successful when using the SAS®-ArcGIS Bridge, the collective name for a suite of geoprocessing tools and Python libraries that allow you to transfer data between ArcGIS and SAS, bring SAS analytics into ArcGIS, and bring spatial data analysis into SAS.
SAS to Table
Once my tables were ready to be read in to Pro, I searched for the SAS to Table tool in the Geoprocessing Pane. I input the library reference and the name of my table in SAS (in my case, “Sasuser.State”), and the name I’d like my table to have once it’s read into Pro (“State”).
My desired field types, lengths, and aliases all come through! For example, my field called State_abbrev is a text field of length 2. The aliases on my numeric fields came from my field labels that I applied in SAS.
Similarly, for my table for metro areas, the names of the metros are not truncated because ArcGIS Pro honors the length of this text field that I set in SAS.
The Opposite: Table to SAS
Do you have a resulting attribute table from some geoprocessing steps that you now want to use in SAS? There’s a conversion tool for this workflow as well: Table to SAS. With this tool, you have the option to replace a SAS dataset with the same name (the equivalent of the replace statement option in the import procedure).
These two conversion tools can be used in the graphic user interface in ArcGIS Pro (as shown), and also in scripts that utilize ArcPy. These tools allow you work with SAS on your desktop (as I have done here), or using SAS Cloud Analytical Services (CAS).
The frustrating days of exporting and importing CSVs between SAS and ArcGIS are no longer. The SAS®-ArcGIS Bridge enables you to work seamlessly between ArcGIS and SAS, combining two of the most powerful data analysis technologies into a single environment!
If these tools are not working as expected, here are some things to try:
- Review the geoprocessing messages output by the tool. These messages often provide helpful troubleshooting tips.
- Move your SAS table into your Sasuser library. (See more info on setting up custom SAS libraries here.)
- Ensure that Pro is finding SAS, especially if you run SAS on your local drive. If the tool is unable to begin a SAS session, this could be the issue.
- For more information, see the official help doc for SAS to Table and Table to SAS conversion tools.
Note: the above steps were performed using ArcGIS Pro 2.8.3 and Base SAS 9.4 M5.