09-07-2017 03:33 PM
I feel like I will not be ablt to ask questions fast enough. I work for the department of public health and am using the data we have to plot disease incidence within our 6 county district down to the address. So far i have successfully geocoded my data and that is about it.
Currently I need to figure out how to:
The department of public health divides their districts into unique groups so no real shapfile exists for my district. If I use a shapefile that spans the entire state is there a way to focus in on just the 6 county area that the data will be confied to? If I can not effectively zoom in on our area of intrest, is there a way to merge shapefiles from different counties to effectively create the shapefile I need?
I am very unclear on what an annotated data set is at the moment. I beleive that it essentially is a set of instructions for SAS on how to display the geocodded data onto the map but I am not sure where exactly to start.
I was told that there are three components, the map dataset, annotated dataset and the response dataset. I believe that the line betweeen the reponse and annotated are starting to blur together for me and I need the diffrerences.
I am a visual learner. There are no videos on youtube or on the SAS website which i can see someone created and run code from start to finish in geocoding. Talking on the phone to SAS techical support helps but only goes so far. Below is the example code that I received from a tech this afternoon but I have been unable to get them back on the phone to help walk me through.
If there is anyone who would be able to walk me through the process, step-by-step of importing a map from shapefiles, writing annotated dataset code and then running it to get an point graph, I would be forever greatful. Please feel free to edit and add to the sample code I have below.
/* use the address of some of the Visitor Centers in Georgia */ data address; input address $18. @20 city $10. state $ zip; datalines; 1751 Williams Road Columbus GA 31904 2424 Haddock Road Kingsland GA 31548 938 County Road 84 Lavonia GA 30553 1763 U.S. Hwy. 280 Plains GA 31780 ; run; /* Assuming the lookup data has been imported and stored in a library named LOOKUP */ proc geocode data=address out=geocoded method=street lookupstreet=lookup.usm attributevar=(tract); run; data annotate; set geocoded(keep=x y address city state zip rename=(state=stname));; retain xsys ysys '2' when 'a' function 'label'; length color $8; /* create a STATE variable that contains the FIPS codes to match the map data */ state=stfips(stname); /* convert X and Y in the geocode data set to radians to match the map */ x=atan(1)/45 * x ; y=atan(1)/45 * y; /* adjust the hemisphere for the longitude to match the map data set */ x=-x; style='special'; text='J'; position='5'; size=2; /* change the color of the dot based on some value */ select; when (city='Columbus') color='red'; when (city='Kingsland') color='blue'; when (city='Lavonia') color='lib'; when (city='Plains') color='orange'; otherwise color='black'; end; run; /* combine annotate data set with unprojected map data */ data all; set maps.county(where=(state=13)) annotate; run; /* project the data */ proc gproject data=all out=allp dupok; id state county; run; /* separate the annotate and map data sets */ data map anno; set allp; if when='a' then output anno; else output map; run; /* set the map patterns to be empty */ pattern1 v=me c=black r=99; proc gmap data=map map=map; id state county; choro county / anno=anno nolegend; run; quit;
09-07-2017 03:50 PM
If your map data set (after importing) has a variable to indicate county you should be able to make your regional map with something like:
Data myregionmap; set statemap; where countyvariable in (county1, county2, county3, county4...); run;
where county1 would either be the numeric value (county code perhaps if numeric) or the text value "name of county" or "text code".
An annotate data set is a set of coordinates and instructions to place text, symbols or draw lines or polygons. To use with a map data set then the x and y coordinates have to match those used in the map data set. Annotate sets are completely optional though when placing things like a city or county name symbol then that's the way to go.
A response data set has more to do with map regions when using Proc GMAP. The ID variable indicates the identifier for the region and your response set has the ID and response value to display (or possibly allow the procedure to sum, count or average). Point data, such as city/clinic/service point would be in an annotate set.
Please note that there a bunch of macros to help work with annotate data sets. %annomac should be included if you have SAS/Graph to use Proc Gmap.
One resource you want to know is http://robslink.com/SAS/ This website has a large number of different maps, some from the SAS examples others using other data sources and show complete code. You can browse through many pages of image thumbnails to find something like what you may want and find code and data in links.