• Print  |
  • Feedback  |


Quarterly Updates of ZIP Code Data Set Available from SAS Maps Online

In response to requests from many customers, quarterly updates to the SASHELP.ZIPCODE data set are now available for you to download from the SAS Maps Online Web site.

The zip file provided in the download is a SAS data set in transport format, and you should use this file to replace your existing SASHELP.ZIPCODE data set.

The data set contains the following information:

Features of the SASHELP.ZIPCODE Data Set

ZIP Code Centroids

The SASHELP.ZIPCODE data set contains ZIP code centroids, or the geographic centers of the areas, defined by the ZIP codes. You can use centroids and associated data to:

When merged with marketing data, the SASHELP.ZIPCODE data set can enhance a company's marketing strategy to a significant degree.

SAS ZIP Code Functions

ZIPCITY is a SAS written function that utilizes the SASHELP.ZIPCODE file. It takes ZIPCODE as its argument and returns a title case city name and two-character postal code state abbreviation – for example – ZIPCITY('02138') returns "Cambridge, MA".

There are some useful functions that are indirectly related to the ZIP code file:

Support for ZIP Code-Related Issues

Sample code and papers are available at the SAS Customer Support Center Web site. Some recent references are noted here.

The SAS users have presented papers about the SASHELP.ZIPCODE data set. The following paper describes the SASHELP.ZIPCODE data set, how to use it, and offers many examples.

"ZIP Code 411: A Well-Kept SAS® Secret," by Louise Hadden, Abt Associates Inc., Cambridge, MA and Mike Zdeb, University@Albany School of Public Health, Rensselaer, NY. This article is a SAS Users Group International paper that describes the SASHELP.ZIPCODE data set, how to use it, and offers many examples. Read the paper (PDF).

Also available, "Cheap Geocoding: SAS/GIS® and Free TIGER® Data," by Ed Odom and Darrell Massengill of SAS Institute, Cary, NC. The section on Centroid Level Geocoding from this paper provides an example for placement of addresses on a map using the SASHELP.ZIPCODE data set. Read the paper (PDF).

The Maps Online section of the SAS Customer Support Center also has articles of interest. "Displaying Zipcodes on a United States Map" provides a solution for correcting a skewed ZIP code map. Download a copy from the site.

How to Perform More Frequent Updates of ZIP Code Data

Many customers have inquired about using their own ZIP code data sets. These third party custom data sets need NOT include all the variables and attributes contained in the "SASHELP.ZIPCODE" data set, as the functions mentioned in the preceding section do not require all of the variables.

Note that you should sort and index the data set by ZIP code.

The SAS Note 019861 describes how to replace an existing data set with the new one.

Code Samples

The following SAS statements and blocks of code can be used to prepare third-party data sets to replace SASHELP.ZIPCODE.

     /**** format x and y variables if necessary *****/    
    	format Latitude 11.6 ;
    	format Longitude 11.6 ;   
     /**** assign lengths to all variables ****/
         length ZIP 7 X 8 Y 8 ZIP_CLASS $1 CITY $35 STATE 7 STATECODE $2 STATENAME $25
    	  ZIP        ='The 5-digit ZIP Code'
     	  Y          ='Latitude (degrees) of the center (centroid) of ZIP Code. 0.0 for APO/FPO'
     	  X          ='Longitude (degrees) of the center (centroid) of ZIP Code. 0.0 for APO/FPO'
     	  ZIP_CLASS  ='ZIP Code Classification:M= APO/FPO P=PO Box U=Unique zip used for large orgs/businesses/bldgs 
     	  CITY       ='Name of city/org'
     	  COUNTYNM   ='Name of county/parish. No county for APO/FPO'
     	  COUNTY     ='FIPS county code. Blank for APO/FPO'
     	  STATENAME  ='Full name of state/territory'
     	  STATECODE  ='Two-letter abbrev. for state name.'
     	  STATE      ='Two-digit number (FIPS code) for state/territory'
     	  MSA        ='Metro Service Area code by common pop; no MSA for rural'
     	  AreaCode   ='Area Code for ZIP Code. None for APO/FPO'
     	  AreaCodes   ='Multiple Area Codes for ZIP Code. None for APO/FPO'
     	  TimeZone   ='Time Zone for ZIP Code. None for APO/FPO'
     	  GMTOffset  ='Diff (hrs) between GMT and time zone for ZIP Code'
     	  DST        ='ZIP Code obeys Daylight Savings: Y-Yes N-No'
         ALIAS_CITY  ='Alternate names of city separated by ||CITY'
         proc sort data=sasuser.zipcode; by zip; run;

         proc datasets  lib=sasuser memtype=(data index);         
     * create zipcode index          *
         modify zipcode;
         index create zip;