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

Hi,

I have been trying to map customers into three different categories red, green and yellow, which,  as we can see works as expected. When I try to map providers for some reason the co-ordinates did not allign...not sure where did I do wrong. I have included my code here. I would appreciate any suggestion.

Thank you

 

 

 

 

Untitled.png 

Code:

Code:
data mymap;
set maps.USCOUNTY;
where fipstate(state) = 'TX';
run;
/* Remove all internal county boundaries, just keeping the state outline */
proc gremove data=mymap out=outline;
by STATE; id COUNTY;
run;

data PROVIDERS;
set PROVIDER_2 (WHERE = (FLAG =1)); by STATE notsorted;
length function color style $8;
xsys='2'; ysys='2'; hsys='3'; when='a';
function='pie'; style='psolid'; rotate=360; size=1;
color='black';
run;

data outline;
set outline; by STATE SEGMENT notsorted;
length function color style $8;
color='black'; style='mempty'; when='a'; xsys='2'; ysys='2';
if first.SEGMENT then FUNCTION='Poly';
else function='Polycont';
run;
/*
proc gproject data=PROVIDERS out=providers
eastlong degrees latlong dupok;
id county;
run;*/
data outline1;
set providers;
length function color style $8;
xsys='2'; ysys='2'; hsys='3'; when='a';
function='pie'; style='psolid'; rotate=360; size=1;
color='red'; 
run;
data outline_all;
set outline outline1;
run;
 
proc gmap map=mymap data=MAPPING_DATA_SEG4_3 all; 
id state county; format value ranges.; 
choro value / discrete 
midpoints=1 2 3 legend=legend1 
cempty=gray99 coutline=gray99 
anno=outline_all
des='' name="&name"; 
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

I notice you're using maps.uscounty - the x/y in this dataset are already projected, and there's no real way to project your lat/long point data in exactly the same way so that they line up with the map. The trick I use is to start with an unprojected map, and combine the map and point-data, project them together, and then separate them apart again.

 

I have written a little chapter explaining how to do this, which might help:

 

http://robslink.com/SAS/book2/Chapter_07_Annotating_on_Maps.pdf

 

 

View solution in original post

2 REPLIES 2
GraphGuy
Meteorite | Level 14

I notice you're using maps.uscounty - the x/y in this dataset are already projected, and there's no real way to project your lat/long point data in exactly the same way so that they line up with the map. The trick I use is to start with an unprojected map, and combine the map and point-data, project them together, and then separate them apart again.

 

I have written a little chapter explaining how to do this, which might help:

 

http://robslink.com/SAS/book2/Chapter_07_Annotating_on_Maps.pdf

 

 

sandeshregmi0
Calcite | Level 5

Thank you Rob. It worked 🙂

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1149 views
  • 1 like
  • 2 in conversation