BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RandoDando
Pyrite | Level 9

I am trying to create a "state-level" map for Puerto Rico using a choro variable in another data set containing values for each state.  GMAP isn't outputting a very good map.  I get a warning that some observations were discarded when charting score.  I've run frequencies on score and state and nothing had any missing values.  No records were omitted when matched with the outside data set to get the score.  Not sure what's going on here.   I am using the US_ALL set which is county level but the only one with Puerto Rico.  I used GREMOVE to remove the county boundaries.

 

Surely it's something simple...

data PR_map; set MAPSGFK.US_ALL (where=(statecode='PR' ) ) ;
run;


PROC GREMOVE DATA = PR_MAP
OUT = PR_MAP_S;
ID county;
BY state; 
run;

proc sql;
create table  PR_map1 as select a.*, b.score  
from PR_map_s a 
inner join
SCORE_STATE b on a.state = (b.fips/1000);
quit;

proc gproject data=PR_map1 out=PR_MAPf latlong eastlong degrees dupok  ;
id statecode;
run;



goptions reset=all;
pattern1 value=m3N45 color=black;
pattern2 value=msolid color=BILG;
pattern3 value=msolid color=gold;
pattern4 value=msolid color=orange;
pattern5 value=msolid color=VIYPK;
title 'Puerto Rico';


proc gmap data=PR_mapf map=PR_mapf;
id statecode;
choro score / nolegend  midpoints=(0 1 2 3 4 ) 
 des='' name='PRMAP' ;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

In your Proc Gremove, you're using "id county" ... but in the Puerto Rico map, it has a county level, but also goes one level below county. In all our SAS maps, we set the variable 'id' to be the lowest level, therefore you can use "id id" (rather than "id county") to make sure gremove knows what the lowest level of granularity is.

 

Here's your code, modified to rid of all the internal boundaries in Puerto Rico:

 

data PR_map; set MAPSGFK.US_ALL (where=(statecode='PR' ) ) ;
run;
PROC GREMOVE DATA=PR_MAP OUT=PR_MAP_S;
ID id;
BY statecode;
run;
proc gmap data=pr_map_s map=pr_map_s;
id statecode;
choro segment / levels=1 nolegend;
run;

 

pr.png

 

View solution in original post

2 REPLIES 2
GraphGuy
Meteorite | Level 14

In your Proc Gremove, you're using "id county" ... but in the Puerto Rico map, it has a county level, but also goes one level below county. In all our SAS maps, we set the variable 'id' to be the lowest level, therefore you can use "id id" (rather than "id county") to make sure gremove knows what the lowest level of granularity is.

 

Here's your code, modified to rid of all the internal boundaries in Puerto Rico:

 

data PR_map; set MAPSGFK.US_ALL (where=(statecode='PR' ) ) ;
run;
PROC GREMOVE DATA=PR_MAP OUT=PR_MAP_S;
ID id;
BY statecode;
run;
proc gmap data=pr_map_s map=pr_map_s;
id statecode;
choro segment / levels=1 nolegend;
run;

 

pr.png

 

RandoDando
Pyrite | Level 9
I knew it was something simple. Thanks!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 678 views
  • 0 likes
  • 2 in conversation