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
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;
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
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
Thank you Rob. It worked 🙂
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.