BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ewillisva
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

 

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

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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