Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

SAS GMAP

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

SAS GMAP

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;

 


Accepted Solutions
Solution
‎11-23-2016 02:10 PM
SAS Employee
Posts: 980

Re: SAS GMAP

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


All Replies
Solution
‎11-23-2016 02:10 PM
SAS Employee
Posts: 980

Re: SAS GMAP

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

 

 

Occasional Contributor
Posts: 8

Re: SAS GMAP

Thank you Rob. It worked Smiley Happy

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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