Chapter Contents |
Previous |
Next |
Using Spatial Data with SAS/GIS Software |
Example 1 |
/* Define the input parameters for Wake County, North Carolina. */ /* Define the import type. */ %let IMP_TYPE = TIGER; /* Specify where the TIGER files for Wake County are located, using the TIGER1 and TIGER2 required filerefs. */ filename TIGER1 '/tgr37183.f51'; filename TIGER2 '/tgr37183.f52'; /* Define the output parameters for Wake County, North Carolina. */ %let MAPLIB = SASUSER; %let MAPCAT = TIGER; %let MAPNAME = COUNTIES; %let CATHOW = CREATE; %let SPALIB = SASUSER; %let SPANAME = COUNTIES; %let SPAHOW = CREATE; /* Initiate the batch import by executing the SCL entry. */ DM 'AF C=SASHELP.GISIMP.BATCH.SCL'; /* Define the input parameters for Durham County, North Carolina. */ /* IMP_TYPE value stays the same, so you just need to reallocate the filerefs to point to the spatial data for Durham County. */ filename TIGER1 'tgr37063.f51'; filename TIGER2 'tgr37063.f52'; /* Define the output parameters for Durham County, North Carolina. */ /* You want the locations to stay the same, so you only need to redefine CATHOW and SPAHOW to update the catalog entries and append to the spatial data sets for the second import. */ %let CATHOW = UPDATE; %let SPAHOW = APPEND; /* Initiate the batch import by executing the SCL entry a second time, this time to add the Durham County data to the Wake County data. */ DM 'AF C=SASHELP.GISIMP.BATCH.SCL';
When the import completes, you can open the map named SASUSER.TIGER.COUNTIES. This map displays Wake and Durham counties.
Example 2 |
/* Construct the data sets to be imported into SAS/GIS. The North Carolina state and county boundaries are obtained from the MAPS.USCOUNTY data set and the North Carolina city locations are obtained from the MAPS.USCITY data set. Both data sets are supplied with SAS/GRAPH software. */ /* Subset just the boundaries for the state of North Carolina. /* data sasuser.nc; set maps.uscounty; /* 37 is the FIPS code for North Carolina.*/ where state=37; run; /* Subset just the cities in North Carolina. */ data sasuser.nccities; set maps.uscity; /* 37 is the FIPS code for North Carolina. */ where state=37; run; /* Define the input parameters for the SASGRAPH import of the boundaries. */ /* Define the import type. */ %let IMP_TYPE = SASGRAPH; /* Specify where map data set is located. */ %let INFILE=SASUSER.NC; /* Specify the identification variables, in hierarchical order. */ %let NIDVARS=2; %let IDVAR1=STATE; %let IDVAR2=COUNTY; /* Define the output parameters for the boundaries. */ %let MAPLIB = SASUSER; %let MAPCAT = NC; %let MAPNAME = NC; %let CATHOW = CREATE; %let SPALIB = SASUSER; %let SPANAME = NC; %let SPAHOW = CREATE; /* Initiate the batch import by executing the SCL entry. */ DM 'AF C=SASHELP.GISIMP.BATCH.SCL'; /* Define the input parameters for the GENPOINT import of the cities. */ /* The import type has changed, so redefine the IMP_TYPE macro variable. */ %let IMP_TYPE=GENPOINT; /* Specify where the generic point data are located. */ %let INFILE=SASUSER.NCCITIES; /* Define the number of identification variables. If you want all of the cities to be contained in one layer, don't define any. */ %let NIDVARS=0; /* Define the output parameters for the cities. */ /* You want the locations to stay the same, so you only need to redefine CATHOW and SPAHOW to update the catalog entries and append to the spatial data sets for the second import. */ %let CATHOW = UPDATE; %let SPAHOW = APPEND; /* Initiate the batch import by executing the SCL entry a second time,this time to add the points to the boundaries. */ DM 'AF C=SASHELP.GISIMP.BATCH.SCL';
When the import completes, you can open the map named SASUSER.NC.NC. This map displays the state and county boundaries for North Carolina. You can select to display the city points on the map.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.