Examples


The following examples use shapefiles with the .shp and .dbf extensions. Replace the shapefiles locations, filenames, and field-identifiers with information from your shapefiles to run these examples.

Example 1: Including All Variables from the SHP Shapefile

In the following example,World30.shp contains polygons that compose a political boundary world map. All the field identifiers in the World30.shp file will be included in the traditional map data set, MYWORLD, created in the SASUSER library.

 PROC MAPIMPORT OUT=sasuser.myworld DATAFILE=C:\world30.shp;  run; 

Example 2: Including Selected Variables from the SHP Shapefile

In the following example, the STATES.SHP file contains polygons that compose the political boundaries of a U.S. states map. Only the STATE_FIPS (the state FIPS codes), STATE_NAME (the state name ), and STATE_ABBR (the two letter state abbreviation) variables are included in the traditional map data set, MYSTATES, which will be created in the SASUSER library. STATE_FIPS will be renamed FIPS, STATE_NAME will be renamed STATE, and STATE_ABBR will be renamed ABBREV in the MYSTATES map data set.

 PROC MAPIMPORT OUT=sasuser.mystates DATAFILE=C:\states.shp;       SELECT STATE_FIPS STATE_NAME STATE_ABBR;       RENAME STATE_FIPS=FIPS STATE_NAME=STATE STATE_ABBR=ABBREV;  run; 

Example 3: Excluding a Variable from the SHP Shapefile

In the following example, the STATES.SHP file contains polygons that compose the political boundaries of a U.S. state map. The variable OTHER is excluded from the traditional map data set, MYSTATES2, created in the SASUSER library.

 PROC MAPIMPORT OUT=sasuser.mystates2 DATAFILE=C:\states.shp;       EXCLUDE OTHER;  run; 

Example 4: Including Selected Variables from the DBF Shapefile

In the following example, the STATES.DBF file contains the identification information (field-identifier names and values) applied to the U.S. states polygon map. Only the STATE_FIPS (the state FIPS codes), STATE_NAME (the state names ), and STATE_ABBR (the two letter state abbreviations) variables are included in the traditional map data set, MYDATA, which will be created in the SASUSER library. STATE_FIPS will be renamed FIPS, STATE_NAME will be renamed STATE, and STATE_ABBR will be renamed ABBREV in the MYDATA map data set.

 PROC MAPIMPORT OUT=sasuser.mydata DATAFILE=C:\states.dbf;       SELECT STATE_FIPS STATE_NAME STATE_ABBR;       RENAME STATE_FIPS=FIPS STATE_NAME=STATE STATE_ABBR=ABBREV;  run; 



SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net