Chapter Contents

Previous

Next
Using Spatial Data with SAS/GIS Software

Implementation

Parameters for the import are specified by assigning a value to a macro variable or by assigning a fileref, as indicated. There are several ways to assign a value to a macro variable, including the %LET statement, the SYMPUT SAS CALL Routine in the DATA step, and the SYMPUT/SYMPUTN function in SCL. As long as the value you want is stored in the macro variable along with the required name, it does not matter which method you use. However, all examples in this section use the %LET statement.

There are also several ways to assign a fileref, including the FILENAME statement, the FILENAME function in SCL, and host-specific file allocation mechanisms. However, all examples in this section use a FILENAME statement.


Specifying the Input Parameters

The input parameters define the type of data to import, the location of the input spatial data, and other specifications regarding variables in your data set (not necessary for all import types).

The IMP_TYPE Macro Variable

You must define a macro variable named IMP_TYPE to indicate which type of data you are going to import. This parameter is required. IMP_TYPE Values and Descriptions contains valid values for IMP_TYPE.

IMP_TYPE Values and Descriptions
Value Description
TIGER Topologically Integrated Geographic Encoding and Referencing (TIGER) files from the U.S. Census Bureau and commercial data vendors
DYNAMAP Dynamap files from Geographic Data Technology, Inc. (GDT)
DLG Digital Line Graph (DLG) files from the U.S. Geological Survey and commercial data vendors
DXF Drawing Interchange Files (DXF) produced by a variety of mapping and CAD software packages
ARC Uncompressed ARC/INFO E00 transport files from Environmental Systems Research Institute, Inc. (ESRI)
SASGRAPH SAS/GRAPH map data set format
GENLINE Generic Line format SAS data set
GENPOINT Generic Point format SAS data set
GENPOLY Generic Polygon format SAS data set
MAPINFO MapInfo Interchange format files from MapInfo Corporation

For example, to import a TIGER file, submit the following statement:

%let IMP_TYPE=TIGER;

INFILE Macro Variable or Required Filerefs

You must specify where the input spatial data is located by using either the INFILE macro variable or the required filerefs for your import type.

For the Generic import types and the SASGRAPH import type, you accomplish this by assigning the name of a SAS data set to the INFILE macro variable. You can specify a one-level or a two-level name. One-level names are assumed to be located in the WORK library. For example:

/* The CUBA data set in the MAPS library. */
%let INFILE=MAPS.CUBA;
or
/* The NC data set in the WORK library. */
%let INFILE=NC;

For all other import types, you must allocate filerefs to point to the files that you want to import. See File Reference Table for additional information about the filerefs for each import type. The following list contains the import types and the filerefs that you are required to assign for them.

TIGER
Assigns the filerefs TIGER1 and TIGER2 for file types 1 and 2, respectively. File types 4, 5, and 6 are optional, these are allocated to the filerefs TIGER4, TIGER5, and TIGER6, respectively. See Hints and Tips for information about using the optional file types.

DYNAMAP
Assigns the filerefs GDT1 and GDT2 for file types 1 and 2, respectively. File types 4, 5, and 6 are optional; these are allocated to the filerefs GDT4, GDT5, and GDT6, respectively. See Hints and Tips for information about using the optional file types.

DLG
Assigns the fileref DLGIN to the Digital Line Graph (DLG) file that you want to import.

DXF
Assigns the fileref DXFIN to the Drawing Interchange File (DXF) that you want to import.

ARC
Assigns the fileref ARCIN to the uncompressed ARC/INFO E00 transport file that you want to import.

MAPINFO
Assigns the filerefs MID and MIF to the MapInfo Interchange format MID file and the MapInfo Interchange format MIF file, respectively.


NIDVARS and IDVARn Macro Variables

Note:    NIDVARS and IDVARn macro variables are for SASGRAPH and Generic Import Types only.  [cautionend]

For SASGRAPH and all of the Generic import types, you must provide additional information regarding variables in your data set.

For SASGRAPH and the Generic Polygon import types, you must also identify the number and names of the variables that uniquely identify unit areas in the map, in hierarchical order. The NIDVARS macro variable must be set to the number of identification variables, and the IDVARn macro variables must specify, in order, the names of the identification variables. For example, for a SASGRAPH import of the MAPS.USCOUNTY data set (which contains State and County boundaries), you specify:

   %let IMP_TYPE=SASGRAPH;
   %let INFILE=MAPS.USCOUNTY;
   %let NIDVARS=2;
   %let IDVAR1=STATE;
   %let IDVAR2=COUNTY;

The value of n in IDVARn ranges from 1 to the value that is specified for the NIDVARS macro variable.

For the Generic Line and the Generic Point import types, you can identify a single variable that will be used to generate layer definitions. You set NIDVARS=1 and IDVAR1=layer variable. A layer is created for each unique value of the specified layer variable. If you specify more than 16 layers, only the first 16 layers are added to the map. If you want all features to be added to a single layer, specify NIDVARS=0. For example, to add all points from a data set to a single layer, specify

   %let NIDVARS=0; 

However, if your points represent stores and you have a SIZE variable that indicates if the store is small, medium, or large, you can specify the following to create three separate layers, one for each value of SIZE:

   %let NIDVARS=1;
   %let IDVAR1=SIZE;


Specifying the Output Parameters

The output parameters define the locations where the output data sets and catalog entries are stored and whether they will be created, replaced, or updated. These parameters are required for all import types. The following list contains the macro variables and a description of the information each specifies.

MAPLIB
Specifies the libref in which the catalog is stored.

MAPCAT
Specifies the catalog in which the entries are stored.

MAPNAME
Specifies the name for the map and coverage entries.

CATHOW
Specifies the action to be used for the catalog entries. Valid values are CREATE, REPLACE, or UPDATE.

SPALIB
Specifies the libref in which the spatial data sets are stored.

SPANAME
Specifies the name of the spatial entry and the prefix for the spatial data sets.

SPAHOW
Specifies the action to be used for the spatial data sets. Valid values are CREATE, REPLACE, or APPEND.


Initiating the Batch Import

You initiate the batch import by executing the SASHELP.GISIMP.BATCH.SCL entry. You do not pass any parameters directly to the SCL entry; the parameters must all have been defined through macro variables and filerefs before you call the SCL entry. The SASHELP.GISIMP.BATCH.SCL entry can be executed by using any one of the following methods:

Enter the following command from a DMS command line:

     AF C=SASHELP.GISIMP.BATCH.SCL

Submit a DM statement that will issue the AF command:

     DM 'AF C=SASHELP.GISIMP.BATCH.SCL';

Use the CALL DISPLAY routine in SCL:

     CALL DISPLAY('SASHELP.GISIMP.BATCH.SCL');


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.