04-14-2016 03:25 PM
my data has zip code column, and we want to see which area of the state has more of the IDs.
One way is to color the zip code on the state map, with color related by zip code frequency
Is there a way to do this in SAS with gmap? Does any one know such an example?
04-14-2016 04:25 PM
First question: Do you have a MAP dataset with Zipcode boundaries? Or are you going to use a center of mass for each Zipcode?
Note: on many STATE level maps Zip code areas can be so small not to be visible, especially if any of the Zip codes you use are of the single building (company) variety.
Do you want to show specific levels of counts such as 1 to 10, 11 to 50, 51 to 100 Ids with each Group having an separate color or a gradient based on count?
Also consider using cirles where the radius indicates number if you have lots of Zip codes close together.
04-14-2016 06:00 PM
04-14-2016 07:00 PM
Depending on the state the ZCTA has lots of holes in it and may not look very good. You may consider county as the SASHELP.ZIPCODE would help match the zip to counties for counting and then use one of the SAS supplied county map data sets.
04-15-2016 03:20 AM
Use a Proc SQL join.Note that the Zip code dataset also has latitude and longitude for approximate center if that might be helpful.
(pseudo code as I am away from my SAS install)
proc sql; create table MyStateZips as select distinct zip, county from sashelp.zipcodes
where statecode = 'XX'; quit;
to get zipcodes for a single state of interest.
Then to look up the county name something like
Proc sql; create MyMergeData as select have.*, MyStateZips.county from have left join MyStateZips on have.zip = MyStateZips.zip; quit;
If you are working in multiple states then you would have to add the state values to the select in the first bit and add to the join in the second.
I actually pulled a unique list of Zip code/county name values for my state of interest and built a number of formats and informats to do the common transformations as I have the opportunity to do something with Zip codes moderately often. I also made sure my county map dataset had numeric and text values for such things as the Fips code, county sequence number as well as county name so that I could often go to mapping with most likely types of county identifiers.
04-15-2016 08:23 AM
A slightly different approach: Many statisticians who are interested in spatial data analysis use metropolitan statistical areas (MSAs) instead of zip codes. MSAs are used by the US census bureau.
04-15-2016 10:52 AM
I realized drawing a map and color the zipcode or region on the map takes a lot of work.
so maybe I do not need such a fancy map but just some charts.
Thanks a lot for all replies.