BookmarkSubscribeRSS Feed

Setting Up PROC GEOCODE: A Step-by-Step Guide

Started 7 hours ago by
Modified 7 hours ago by
Views 58

Geocoding refers to the process of converting addresses or places names into geographic coordinates that can be plotted on a map. In SAS Viya, there are many ways to geocode data, including services from Esri and Loqate. However, both of these services charge a per-address cost, meaning that geocoding large volumes of data can get expensive. SAS also provides a geocoding procedure, called PROC GEOCODE. Unlike using Esri or Loqate services, PROC GEOCODE is free and performs the processing locally, without passing addresses back and forth to a third-party database. In this article, I will discuss how to access and configure the necessary lookup data sets to use the GEOCODE procedure in your own environment.

 

 

Where to Find the Lookup Data

 

PROC GEOCODE relies on lookup data sets in your own SAS environment. In order to geocode US street addresses, six lookup data sets are required:

 

  • Street matching: contains street names
  • Street segment: contains street suffixes, prefixes, and direction
  • Street coordinate: contains latitude and longitude points
  • Street state: contains state character names
  • Street type: contains common street type suffixes and prefixes
  • Street directional: contains directional prefixes and suffixes (for example, “N” or “North”)

 

Together, these six data sets allow SAS to match street addresses to specific latitude and longitude coordinates. However, only the street state, street type, and street directional data sets are included by default with SAS, located in the SASHELP library. The street matching, street segment, and street coordinate data sets can be downloaded from the Maps and Geocoding SAS support website.

 

To access the download, click the Street Geocoding Downloads link on the Geocode Data page and sign in with your SAS profile.

 

tremain_procgeo_01.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

This opens a list of all available geocode dataset downloads. US geocoding lookup datasets are based on US Census Bureau TIGER/Line shapefiles, meaning that they are generally updated once a year when new Census data becomes available.

 

tremain_procgeo_02.png

 

Once you click on the desired year, you will be prompted to validate your site number.

 

tremain_procgeo_03.png

 

You can find your site number in SAS Viya by clicking Profile in the top right and selecting About.

 

tremain_procgeo_04.png

 

You can also find it by running PROC SETINIT in SAS Studio:

 

proc setinit;
run;

 

After you enter your site number, you’ll need to accept a license agreement before the download starts.

 

tremain_procgeo_05.png

 

 

Installing the Lookup Data

 

The lookup data download is provided as a ZIP file. The unzipped file contains 10 CSV files, a ReadMe, and a SAS program.

 

tremain_procgeo_06.png

 

To create the three lookup SAS tables, you need to first move the unzipped files to a location accessible by SAS. Then, open the ImportCSVfiles.sas program and modify the PATHIN and PATHOUT macro variables. The PATHIN macro variable should point to the location where the CSV files have been stored, and PATHOUT should point to a location where the finished lookup tables will be stored.

 

tremain_procgeo_07.png

 

Then, run the program. The code will import all 10 CSV files and combine them to create the three necessary geocoding tables, in a library called lookup. You only need to do this once, and then you can simply reference the lookup library as necessary when using PROC GEOCODE.

 

tremain_procgeo_08.png

 

 

What if I Need to Create My Own Lookup Data?

 

If you need lookup data beyond the prebuilt US geocoding lookup tables available for download, SAS also provides several programs that allow you to create lookup data from the original source. The Canadian NRN Import Code program and the Code To Import US TIGER files for 9.4 allow you to download Canadian National Road Network and Census Bureau TIGER/Line shapefiles and process them yourself.

 

 

Conclusion

 

PROC GEOCODE offers a powerful and cost-effective alternative to third-party geocoding services, allowing you to process addresses entirely within your own SAS environment. By downloading the necessary lookup data sets from the SAS support website and running the provided import program, you can quickly set up a fully functional geocoding pipeline. With support for both US and Canadian data and the flexibility to work with regional subsets, PROC GEOCODE is a practical solution for organizations looking to convert addresses into geographic coordinates at scale.

 

 

Tips and Tricks

 

  • PROC GEOCODE works with Canadian and US data. SAS does not provide resources to create lookup data for other countries, so other geocoding providers may be a better fit if you need global coverage.
  • If you work exclusively on data in a single state or smaller region, you can create lookup data for limited regions and improve performance.
  • Address data must have at least a street address and a ZIP code to be geocoded using PROC GEOCODE.

 

 

Find more articles from SAS Global Enablement and Learning here.

Contributors
Version history
Last update:
7 hours ago
Updated by:

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags