01-18-2013 01:10 PM
I'm trying to create a basic heat map by regions using proc GMAP. I would like to create five fixed choro ranges that don't change, even if values aren't available for that particular month (i.e. in the code below, there are no values under 40% or above 70%). I created a ranking variable in my data set ("Change") to be modified by the proc format and in the choro statement. However, the choro continues to work on the range of available values, ignoring the format. Any help is appreciated. Thanks!
5="70% and Up";
pattern1 v=ms c=Green;
pattern2 v=ms c=Lig;
pattern3 v=ms c=Yellow;
pattern4 v=ms c=Red;
pattern5 v=ms c=Maroon;
format Change Change_Groups.;
choro Change / levels=6 legend=legend1 coutline=black html=Data_html;
01-18-2013 04:29 PM
Are your change values actually in the map data set? If so try creating a separate data set with the change varaible and the appropriate Id variable only and use it as the Data=dataset.
01-18-2013 05:19 PM
The variable is in the data set, but I want it to format based on variable that may or may not be in that variable. For example, I want a green shade for any values under 40%, so if there are not any values under 40%, I don't want green to show up.
01-21-2013 08:56 AM
Note that your map= data set should be a map, and the data= data set should be your response data.
I think you will want to use code something like the following (this is not complete code, but should get you going in the right direction):
data Data_Proj; set Data_Proj;
if Change<.4 then change_category=1;
else if Change<.49 then change_category=2;
else if Change<.59 then change_category=3;
else if Change<.69 then change_category=4;
proc gmap data=Data_Proj map=maps.us;
format change_category Change_Groups.;
choro change_category / midpoints= 1 2 3 4 5;
I also recommend getting a good understanding of the gmap fundamentals, by reading Mike Zdeb's excellent book: http://www.amazon.com/Maps-Made-Using-Carpenters-Software/dp/1590470931