Data visualization with SAS programming

proc gmap MSA mapimport

Reply
Frequent Contributor
Posts: 104

proc gmap MSA mapimport

[ Edited ]

Hi everyone,

 

Using Mapimport, I imported the US Census Metropolitian Division 2010 shp file into SAS.  However, when I combine the map file ("metdiv_shp") with my data ("test"), my final map only includes a small fraction of my observations though there should be many more.  Here's a sample of my code.  The ID variable ("METDIVFP10") for both the data file and the map file are exactly the same.   

 

Any thoughts on why my output is limited to a few observations?   Am I missing something with my proc gmap code? Or the import command? When I use the SAS supplied maps (i.e. maps.us), it works fine.

 

Thanks!

 

proc mapimport datafile="r:\tl_2010_us_metdiv10.shp" out=metdiv_shp; run;

 

data test;

input METDIVFP10 $5. poptest 8.2;

datalines;

00080 5.56

00120 11.76

00160 7.01

00200 22.22

00220 75.00

00240 5.88

00320 40.00

00380 83.34

19000 61.20

37200 43.20

;;

run;

 

proc gmap data=test map=metdiv_shp all;

id METDIVFP10;

choro poptest /discrete coutline=black;

run;

quit;

SAS Employee
Posts: 170

Re: proc gmap MSA mapimport

I loaded down same Census file and I don't see any values of the variable METDIVFP10 from the data set TEST that match the data set METDIV_SHP.  

Frequent Contributor
Posts: 104

Re: proc gmap MSA mapimport

[ Edited ]

Thank you for your reply!  I'm sorry for the copy and paste issue. Please find below the correct 'test' dataset,  With that said, when I run the updated datset with the right METDIVFP10 values, I still get the same problem.  Below is the updated 'test' dataset.  What do you see when you run it?

 

data test;

input METDIVFP10 $5. poptest 8.2;

datalines;

14484 5.56

15764 11.76

15804 7.01

29404 22.22

31084 5.88

36084 61.20

13644 43.20

19124 88.05

;;

run;

 

SAS Employee
Posts: 170

Re: proc gmap MSA mapimport

Your TEST data set doesn't have all of the of the values for METDIVFP10 (13644, for example), so some polygons are shown as a "blank" (no color other than the outline) with GMAP.  The map (METDIV_SHP) itself is showing everthing that it has.  I looked at the Shapefile directly with another product and it was the same as in SAS.  

 

Is that your problem or is there something I am missing?

Frequent Contributor
Posts: 104

Re: proc gmap MSA mapimport

Hi Darrell,

 

Thanks for your reponse. I think you've got the problem. 

 

I've attahed a pdf of my output.  As you can see I have a combination of 'blank' (i.e. no color other than outline), colored polygons and lots of empty space.  The colored polygons matched the 8 observations from my "test" dataset.  However, I thought by using the "all" options on proc gmap, the output would include all values for METDIVFP10, even if they were not included in my 'test' dataset.   Does this make sense?

 

 

SAS Employee
Posts: 170

Re: proc gmap MSA mapimport

[ Edited ]

Yes.  ALL is what causes GMAP to put up the "blank" polygons.  If you didn't have ALL, then it wouldn't even put up the outlines on the "blank" polygons.  The empty space has no polygons in the shapefile.  There is just nothing there.  This  map is just the shapefile using a NON-SAS product to display it. 

Shapefile.PNG

 

Frequent Contributor
Posts: 104

Re: proc gmap MSA mapimport

Given that, is there no way to display a map using MSA boundaries via SAS?

 

Thank you for your time!

 

SAS Employee
Posts: 170

Re: proc gmap MSA mapimport

It isn't SAS.  It is the Census map data.

 

There are several MSAs.  Metropolitian Statistical Areas and Micropolitian Statistical Areas.  I'm not sure Metropolitian Divisions are the same thing.  "Metropolitan Divisions are smaller groupings of counties or equivalent entities defined within a metropolitan statistical area containing a single core with a population of at least 2.5 million.  Not all metropolitan statistical areas with urbanized areas of this size will contain metropolitan divisions."

I wonder if you want Metropolitian Statistical Areas and Micropolitian Statistical Areas.

 

Read this explanation of CBSAs on the Census site:  https://www.census.gov/geo/reference/gtc/gtc_cbsa.html

 

You can get the various files from here: https://www.census.gov/geo/maps-data/data/tiger-line.html

 

Ask a Question
Discussion stats
  • 7 replies
  • 697 views
  • 0 likes
  • 2 in conversation