Data visualization with SAS programming

Creating a map with combined boundaries - distorted image

New Contributor
Posts: 4

Creating a map with combined boundaries - distorted image

[ Edited ]



I am trying to create a map of the US showing only state and MSA (metropolitan statistical area) boundaries, using county-level data (maps.uscounty). I am currently using a guide to help me, but am still having difficulty (see link below)


I was able to create an MSA variable (which combines several counties) and merge it with the map file based on county ID. In concert with the GREMOVE procedure, this should remove the barriers between counties within MSAs. However, when I invoke GMAP, it looks distorted. 


So then I try GPROJECT, which should correct the distortion, but then it tells me that I have data on both sides of the equator (see error message below).


NOTE: PARALLEL1 = -4.960619304.
NOTE: PARALLEL2 = 8.0288480358.
ERROR: Standard parallels lie on opposite sides of the equator.
ERROR: Equator is too close to the median latitude of the map data set for default parallel calculation. Try specifying PARALLEL1
and PARALLEL2 values explicitly.


However, that can't be the case, because I am only using US data. Oddly, when I look at the SAS projected latitude in the SAS provided map files, there are negative latitude values. I am not sure what to think. 


I am able to graph the data just fine (at the county level) before GREMOVE, but after that it all becomes distorted. Any ideas? 

See code below:



proc sort data=MSA_MAP;
by msa;
proc gremove
by msa;
id county;
proc gproject
id msa;
pattern v=e;
proc gmap
id msa;
choro Phys_Den_Tot_MD / discrete coutline=black;
format Phys_Den_Tot_MD Phys_Den_Tot_MD_.;





Esteemed Advisor
Posts: 5,241

Re: Creating a map with combined boundaries - distorted image

Posted in reply to sasquatch

maps.uscounty X and Y positions are already projected coordinates, you cannot project them again. Try using the mapsgfk.us_counties dataset which has LAT and LONG (unprojected) coordinates instead.

SAS Employee
Posts: 995

Re: Creating a map with combined boundaries - distorted image

Posted in reply to sasquatch

Probably the quickest/easiest most direct replacement would be using the unprojected maps.counties, rather than the projected maps.uscounty.


One problem though, when projecting the map on your own, is that Alaska and Hawaii will be in their 'proper' location, rather than moved & re-sized to fit in the bottom/left corner of the map.


I'm thinking this "should" work ok using already-projected maps.uscounty (without re-projecting it). Could you provide some more info about how it looks 'distorted'?

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation