BookmarkSubscribeRSS Feed
sophia_SAS
Obsidian | Level 7

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;

7 REPLIES 7
Darrell_sas
SAS Employee

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.  

sophia_SAS
Obsidian | Level 7

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;

 

Darrell_sas
SAS Employee

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?

sophia_SAS
Obsidian | Level 7

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?

 

 

Darrell_sas
SAS Employee

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

 

sophia_SAS
Obsidian | Level 7

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

 

Thank you for your time!

 

Darrell_sas
SAS Employee

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

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2586 views
  • 0 likes
  • 2 in conversation