Upload
christine-leslie-parrish
View
233
Download
0
Tags:
Embed Size (px)
Citation preview
Introduction to Introduction to PROC GMapPROC GMap
Presentation by
Andrea Boan
BMTRY 789
Map of US with LA and NYCMap of US with LA and NYC
Too Skinny
Too Fat
Proc GMapProc GMap Produces two basic kinds of maps:Produces two basic kinds of maps:
Two-dimensional – choropleth maps Two-dimensional – choropleth maps Three-dimensional - block, prism, and surfaceThree-dimensional - block, prism, and surface
Use to create color maps to show variations value Use to create color maps to show variations value with respect to an areawith respect to an area
SAS/GRAPH software – provides an extensive SAS/GRAPH software – provides an extensive assortment of map data sets and codesassortment of map data sets and codes
Use the GMAP procedure to:Use the GMAP procedure to: Produce mapsProduce maps Summarize data by physical areaSummarize data by physical area Show geographical trends and variationsShow geographical trends and variations Emphasize regional differencesEmphasize regional differences
Four Basic Types of MapsFour Basic Types of MapsBlock Map
Prism Map
Surface Map
Forth Type of MapForth Type of Map(we will learn to make today)(we will learn to make today)
Two-dimensional Choropleth Maps
Finding Proc GMap in SAS Help DocFinding Proc GMap in SAS Help Doc
1.1. SAS Help and DocumentationSAS Help and Documentation
2.2. SAS ProductsSAS Products
3.3. SAS/GraphsSAS/Graphs
4.4. SAS/Graphs ReferenceSAS/Graphs Reference
5.5. SAS/Graphs ProceduresSAS/Graphs Procedures
6.6. The GMap ProcedureThe GMap Procedure
This will provide basic information and basic examples along with This will provide basic information and basic examples along with formatting optionsformatting options
Getting SAS Data for MapsGetting SAS Data for Maps
Go to the Official SAS Website and register an account:Go to the Official SAS Website and register an account:http://www.sas.com/apps/userid/login.jsphttp://www.sas.com/apps/userid/login.jsp = MyProfile = MyProfile
The go to: The go to: Download SoftwareDownload Software SAS/GRAPH SoftwareSAS/GRAPH Software Maps OnlineMaps Online Version 6.12 Maps – Top Left Side Panel Version 6.12 Maps – Top Left Side Panel Scroll down to desired countryScroll down to desired country For This example select the last US data available For This example select the last US data available Select Data or CodeSelect Data or Code Click Request DownloadClick Request Download Click Accept on terms and conditionsClick Accept on terms and conditions
You Should see something that You Should see something that looks like this screenlooks like this screen
Description File NameReleas
eDate
Size
GIF image, SAS Code, DATA set
uscounty.zip
Oct 2002
450KB
Click Download
Save to a File
CIMPORT ProcedureCIMPORT Procedure
libname maps "C:\Data";libname maps "C:\Data";***************************************************************\***************************************************************\| Copyright (C) 2002 by SAS Institute Inc., Cary, NC, USA. || Copyright (C) 2002 by SAS Institute Inc., Cary, NC, USA. || || || SAS (R) is a registered trademark of SAS Institute Inc. || SAS (R) is a registered trademark of SAS Institute Inc. || || || SAS Institute does not assume responsibility for the accuracy of || SAS Institute does not assume responsibility for the accuracy of || any material presented in this file. || any material presented in this file. |\***************************************************************/\***************************************************************/
/* Using the CIMPORT procedure to import SAS tables *//* Using the CIMPORT procedure to import SAS tables */
/********************************************************************/******************************************************************** * Since the transport files are created by PROC CPORT, you need to ** Since the transport files are created by PROC CPORT, you need to ** use PROC CIMPORT to process the transport file. You can import ** use PROC CIMPORT to process the transport file. You can import ** files to a release SAME as or HIGHER than the release used to ** files to a release SAME as or HIGHER than the release used to ** create the transport file. ** create the transport file. * ********************************************************************/********************************************************************/
/********************************************************************/******************************************************************** * Example 1: ** Example 1: * * PROC CIMPORT uses the file given in the INFILE= option as input ** PROC CIMPORT uses the file given in the INFILE= option as input * * and writes/unpacks/copies all data sets found in the transport ** and writes/unpacks/copies all data sets found in the transport * * file to the directory referenced by the libref SASFILES. ** file to the directory referenced by the libref SASFILES. * ********************************************************************/********************************************************************/
After downloading and unzipping SAS tables you must take them out of transport format by running the CIMPORT procedure
Change Libname to =MapsChange Libname to =Maps
libname sasfiles 'c:\myfiles';libname sasfiles 'c:\myfiles'; procproc cimportcimport infile='C:\ infile='C:\Data\uscounty.cpt' Data\uscounty.cpt' library=maps;library=maps; runrun;;
SAS GMap Data SetsSAS GMap Data Sets
Data Set we are using:Data Set we are using: USCounty – raw plotting dataUSCounty – raw plotting data Cntyname – just county name variableCntyname – just county name variable
Proc GProject = processes traditional map Proc GProject = processes traditional map data sets by converting spherical data sets by converting spherical coordinates (longitude and latitude) into coordinates (longitude and latitude) into Cartesian coordinates for use by the GMAP Cartesian coordinates for use by the GMAP procedure procedure
Choro = tells SAS which type of map to Choro = tells SAS which type of map to make – a Two-dimensional make – a Two-dimensional Choropleth Map Map
PROC GMap CodePROC GMap Code
libname maps "C:\Data"; data sccounty; set maps.cntyname; where state=45; run;quit; data scdata; set maps.uscounty; where state=45; run;quit; proc gproject data=scdata out=scmap; id county; run;quit; proc gmap map=scdata data=sccounty; id county; choro countynm; run;quit;
1. Rename Data to get SC only from maps.Cntyname
2. To get county names
3. SC = State = 45
4. Rename Data to get SC data from maps.uscounty
5. SC = State = 45
6. Proc Gproject – map is inverted in SAS so have to project it.
7. Out = scmap by county
8. Proc GMap – gives Cholopleth map of SC colored by county
9. Choro by countynm
QuestionsQuestions