How to use a file other than the Zipcode data set supplied by SAS®


A data set that contains ZIP code information is supplied by SAS. It is located in the Sashelp library, and the fully qualified name is Sashelp.Zipcode.

See Usage Note 19861: "How to replace the Sashelp.Zipcode data set", for additional information about how to update this file.

If you choose to use another file containing ZIP codes, you will have to make some changes to the normal method for using the functions and procedures related to using that data.

NOTE: SAS will not provide support when using a ZIP code file that was not supplied by SAS.

If you are using a Windows or UNIX operating environment, follow the instructions below to include an additional directory for SAS to search in order to use the non SAS ZIP code file.

  1. The following line can be added to the sasv9.cfg file in your home directory. The directory that you supply is used first for the -sashelp option when the SAS system initializes.

    -insert sashelp /usr/zipcode/dir

    The directory path /usr/zipcode/dir is an example of where you could store the new file. You should replace this with the actual location that you choose, and follow the operating system guidelines for the path reference.

  2. To validate the change, invoke SAS and run the following:
    proc options option=sashelp; 
    run; 
    

    The code above returned the results below. Again, you will see your library location in place of the path in the example.

    SASHELP=('/usr/zipcode/dir' '!SASROOT/nls/en/sascfg' '! SASROOT/sashelp')

  3. To set Write permissions for your account to the Sashelp folder, whose path is typically C:\Program Files\SAS\SASFoundation\9.x\core\sashelp, follow the seven steps only in the section entitled "Setting File and Folder Permissions" in the following Microsoft article.

Contact your company's IT staff or system administrator if you have problems performing these steps.

If you are using an MVS operating environment, see the JCL and job stream below that is required to use the file. This is the JCL (Job Control Language) required to use the additional ZIP code file. This is a sample job stream that will have to be modified to meet your specific situation. The following job stream demonstrates how the same capability is available using MVS by providing a config option:

//ZIPCITYX JOB ,JONES
/*JOBPARM FETCH
//  EXEC SAS92P
//*MYZIPS   DD DSN=&&MYZIPS,DISP=(NEW,PASS),UNIT=SYSDA,
//*  SPACE=(CYL,(50,10))
//MYZIPS    DD DSN=SASXXX.MYTEST.SASHELP,DISP=OLD
//MYCONFIG DD DSN=&&MYCONFIG,DISP=(NEW,PASS),UNIT=SYSDA,
//  SPACE=(TRK,10)
//SYSIN  DD  *
proc contents data=sashelp.zipcode; run;
data temp; zip=96799; city='Pago Pago'; state=60; run;
data myzips.zipcode(index=(zip)); merge sashelp.zipcode temp;
     by zip;
     run;
data myzips.tryit; x=1; run;
proc contents data=myzips.zipcode; run;
data _null_; file myconfig;
     put 'SASHELP=(';
     PUT '         ''MVS:SASXXX.MYTEST.SASHELP''';
     put '         ''MVS:SDC.SAS9CURR.ENW0.SASHELP''';
     put '        )';
     run;
//  EXEC SAS92P,CONFIG='&&MYCONFIG'
//SYSIN  DD  *
proc options option=sashelp; run;
data _null_; set sashelp.tryit; put _all_; run;
data _null_; x=zipcity('96799'); put x=; run;
//  EXEC SAS92P
//SYSIN  DD  *
proc options option=sashelp; run;
data _null_; x=zipcity('96799'); put x=; run;