/* Specify folder containing unzipped Delaware shapefiles. */
%let TIGERPATH=C:\Public\Import TIGER\Shapefiles;
/* Specify the library to output the GIS catalog. */
%let MAPLIB=SASUSER;
/* Specify the catalog name for the GIS map and layer entries. */
%let MAPCAT=DELAWARE;
/* Specify the name of the GIS map entry. */
%let MAPNAME=COUNTIES;
/* Specify the library to output the GIS spatial data sets. */
%let SPATIALDATALIB=SASUSER;
/* Specify the base name for the GIS spatial data sets. */
%let SPATIALNAME=DELAWARE_;
/* Compile the TIGER/Line shapefile import program. */
FILENAME TIGER CATALOG 'SASHELP.GISIMP.TIGER2GIS.SOURCE';
%INCLUDE TIGER / SOURCE2;
/* Invoke the macro program to import the Delaware shapefiles. */
%TIGER2GIS
When the import completes, you can open the map named
SASUSER.DELAWARE.COUNTIES. This map displays the following information
for Delaware: counties, streets, railways, waterways, census tracts,
block groups and blocks, city boundaries, and ZCTAs (ZIP Code Tabulation
Areas)./* Define the input parameters for Wake County,
North Carolina. */
/* Define the import type. */
%let IMP_TYPE = TIGER;
/* Specify the complete path to the TIGER files for Wake County
which were downloaded and unzipped using the required TIGER1
and TIGER2 filerefs. */
filename TIGER1 'tgr37183.rt1';
filename TIGER2 'tgr37183.rt2';
/* 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 that was downloaded and unzipped
for Durham County. */
filename TIGER1 'tgr37063.rt1';
filename TIGER2 'tgr37063.rt2';
/* Define the output parameters for Durham County,
North Carolina. */
/* The locations will stay the same,
so you only need to redefine CATHOW and
SPAHOW to update the catalog entries and
append 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';/* 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 (largest polygon first). */
%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 batch import of the
GENPOINT data set for the cities. */
/* The import type has changed, so redefine the
IMP_TYPE macro variable. */
%let IMP_TYPE=GENPOINT;
/* Specify where the generic point data is 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. */
/* The locations will stay the same, so
you only need to redefine CATHOW and SPAHOW to
update the catalog entries and append 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';