/* Program produces two types of color state maps for 50 states and District of Columbia. SAS already supplies the US boundary file to which your data is mapped to. SAS automatically knows the path to this file. However, your data must have the same two fields specified as theirs. First, you must have a field called Statename. Second, a field named state. State is really the fips code for that state as shown below. */ data mydata; length Statename $20.; input State Myvar Statename $ ; cards; 1 15823 Alabama 2 15324 Alaska 4 15310 Arizona 5 13640 Arkansas 6 15443 California 8 14669 Colorado 9 14422 Connecticut 10 14675 Delaware 11 17685 District Of Columbia 12 15145 Florida 13 15244 Georgia 15 15788 Hawaii 16 13226 Idaho 17 13729 Illinois 18 13500 Indiana 19 13948 Iowa 20 13132 Kansas 21 13219 Kentucky 22 15904 Louisiana 23 13319 Maine 24 15996 Maryland 25 13961 Massachusetts 26 13551 Michigan 27 13932 Minnesota 28 14738 Mississippi 29 13148 Missouri 30 15514 Montana 31 12525 Nebraska 32 15286 Nevada 33 13321 New Hampshire 34 15586 New Jersey 35 14299 New Mexico 36 13777 New York 37 15392 North Carolina 38 14990 North Dakota 39 12927 Ohio 40 14161 Oklahoma 41 13823 Oregon 42 13793 Pennsylvania 44 14124 Rhode Island 45 14696 South Carolina 46 13867 South Dakota 47 14888 Tennessee 48 15904 Texas 49 15917 Utah 50 14184 Vermont 51 15450 Virginia 53 15182 Washington 54 14297 West Virginia 55 14004 Wisconsin 56 16349 Wyoming ; run; /* Map using 4 distinct colors using quartiles */ goptions reset=all; pattern1 value=solid color=green3; pattern2 value=solid color=yellow; pattern3 value=solid color=blue; pattern4 value=solid color=red; goptions border cback=white gunit=pct htext=2.5 ftitle="arial/bold" ftext="arial"; GOPTIONS DEVICE=gif xpixels=600 ypixels=400; GOPTIONS GSFNAME = OutFile GSFMODE = REPLACE DEVICE = GIF FTEXT = 'ARIAL' HTEXT = 1.5; FILENAME OutFile "c:\test.gif"; legend label=(height=2) shape=bar(5,3) value=(height=2); * Define legend; title1 h=4 '(Your Title Here)'; title2 h=3 'State Thematic Map Using 4 Specific Colors'; proc gmap data = mydata map=maps.us; id state; choro myvar /legend=legend levels=4 coutline=black; footnote1 'Try your footnote here.'; run; quit; /* Map using ramping technique between two colors */ goptions reset=all; proc template; define style styles.colorramp; parent=styles.default; /* Define a lighter and darker shade of blue for the starting and ending colors. */ style twocolorramp / startcolor=red endcolor=green; end; run; ods listing style=styles.colorramp; goptions border cback=white gunit=pct htext=2.5 ftitle="arial/bold" ftext="arial"; GOPTIONS DEVICE=gif xpixels=600 ypixels=400; GOPTIONS GSFNAME = OutFile GSFMODE = REPLACE DEVICE = GIF FTEXT = 'ARIAL' HTEXT = 1.5; FILENAME OutFile "c:\test2.gif"; legend label=(height=2) shape=bar(5,3) value=(height=2); * Define legend; title1 h=4 '(Your Title Here)'; title2 h=3 'State Thematic Map Using Ramping'; proc gmap data = mydata map=maps.us; id state; choro myvar /legend=legend levels=4 coutline=black ; footnote1 'Try your footnote here.'; run; quit;