LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 9 Mar 2011 20:03:40 -0500
Reply-To:     Nat Wooding <nathani@VERIZON.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <nathani@VERIZON.NET>
Subject:      Re: Proc GMAP coloring
In-Reply-To:  <AD4D009B201C104A87056D05DAEA2C1D2A1B0C@AZPH-SRV-MAIL09.cvty.com>
Content-Type: text/plain; charset="US-ASCII"

Nick

I'm glad to hear that you are finding SASL and Rob's site useful. He wins awards for his work.

In addition to Art's suggestion, there is another site that you might find useful:

http://colorbrewer2.org/

Also, in the SAS/Graph documentation Concepts section, there is extensive discussion of selecting colors. See the heading SAS/Graph Colors and Images.

Nat

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Adams, Nicholas Sent: Wednesday, March 09, 2011 1:43 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Proc GMAP coloring

Hi, Nat posted this link this week http://robslink.com/SAS/Home.htm and I've found incredibly helpful in learning different graphing procedures.

One I'm working on is based off of the below code. I've been able to get this county level graphing to work for my data. I've added a few ranges so now I have 10 ranges instead of the 6 that this code includes. I'm pretty new at understanding the details of this code, but can someone tell me if there is a way to change the colors that the ranges are being set to. I'd like to have them be different shades of grey with the lighter grey being the lower ranges and darker grey being the higher ranges.

I cant tell from the code what is driving the current green color. (I'd guess it has to do with the pattern 1-6 section of code.) How can I get these to be ascending shades of grey?

Any help would be greatly appreciated. I've only been on this post for about 2 weeks, but have learned alot already!

Nick

CODE:

%let name=nc_unemployment; filename odsout '.';

filename file1 'nc_unemployment_feb_2009.txt'; data my_data; infile file1 lrecl=80 firstobs=3 pad; length county_upcase $20.; informat Labor_Force Employment Unemployment comma12.0; informat Rate comma6.1; format Labor_Force Employment Unemployment comma12.0; format Rate comma6.1; input county_upcase $ Labor_Force Employment Unemployment Rate;

county_upcase=translate(county_upcase,' ','_'); state=37; run;

/* Get numeric county fips code, to match up with the map */ proc sql; create table my_data as select my_data.*, cntyname.county from my_data left join maps.cntyname on my_data.state=cntyname.state and my_data.county_upcase=upcase(cntyname.countynm); quit; run;

/* Calculate an html variable, with multi-line 'chart tip' info, and an html href link */ /* Note that '0D'x is the hexadecimal for a carraige return */ data my_data; set my_data; length myhtmlvar $400; myhtmlvar='title='|| quote( trim(left(county_upcase))||' county, NC'||'0D'x|| 'Unemployment Rate: '||trim(left(rate))||'% ' ) ||' '|| 'href="http://www.google.com/search?hl=en&q=NC+unemployment+'|| trim(left(county_upcase))||'+county"' ; run;

data my_map; set maps.counties (where=(state=37)); run; proc gproject data=my_map out=my_map; id state county; run;

proc sql noprint; select sum(Unemployment)/sum(Labor_Force) format=percentn7.2 into :ncrate from my_data; select sum(Unemployment) format=comma7.0 into :ncunemp from my_data; quit; run; %let ncrate=%trim(&ncrate);

data my_anno; length function $8 style $20 text $100; xsys='3'; ysys='3'; hsys='3'; function='label'; position='6'; x=10; color='gray22'; style='"arial/bold"'; y=45.5; text='February 2009 Unemployment Numbers *'; output; color=''; style='"arial/bold"'; y=y-4.8; text="&ncunemp individuals or &ncrate of North Carolinians"; output; y=y-3; text="were unemployed in the month of February."; output; color='gray22'; style='"arial/bold"'; y=y-4.8; text="Mouse over each county for unemployment numbers."; output;

function='move'; x=10; y=5; output; function='image'; x=x+30; y=y+20; imgpath='./economic_watch.jpg'; style='fit'; output;

run;

GOPTIONS DEVICE=png; goptions xpixels=960 ypixels=540; goptions cback=white;

ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" style=minimal;

goptions gunit=pct htitle=4.25 htext=2.5 ftitle="arial/bold" ftext="arial/bold" ctext=gray66;

title j=l c=gray22 " North Carolina unemployment rates, county-by-county";

footnote1 h=17pct " "; footnote2 h=2.5 j=l link="http://www.ncesc.com/pmi/rates/PressReleases/County/NR_Feb_09_Coun tyRates.pdf" " * Unadjusted data" j=r "Source: Employment Security Commission of North Carolina "; footnote3 h=.5 " ";

legend1 label=(position=(top) j=left "KEY") position=(right bottom) across=2 colmajor mode=share value=(j=right) shape=bar(.15in,.15in) offset=(-5,-18);

data my_data; set my_data; length bucket $15; if rate <= 2.99 then bucket='0 - 2.99%'; else if rate <= 5.99 then bucket='3 - 5.99%'; else if rate <= 8.99 then bucket='6 - 8.99%'; else if rate <= 11.99 then bucket='9 - 11.99%'; else if rate <= 14.99 then bucket='12 - 14.99%'; else if rate <= 17.99 then bucket='15 - 17.99%'; else bucket='???'; run;

pattern1 v=s c=cxe9e9e9; pattern2 v=s c=cxe1f9be; pattern3 v=s c=cx7cd855; pattern4 v=s c=cx27be08; pattern5 v=s c=cx196e06; pattern6 v=s c=cx003300;

proc gmap map=my_map data=my_data anno=my_anno; id state county; choro bucket / midpoints = '0 - 2.99%' '3 - 5.99%' '6 - 8.99%' '9 - 11.99%' '12 - 14.99%' '15 - 17.99%' coutline=grayee legend=legend1 html=myhtmlvar des="" name="&name"; run;

quit; ODS HTML CLOSE; ODS LISTING;

Nick Adams Sr. Health Care Analyst Wellpath, A Coventry Health Care Plan 2801 Slater Road Suite 200 Morrisville, NC 27560 919-337-1815 nradams@cvty.com Coventry Data Classification: Confidential Use Only

Email Confidentiality Notice: The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law, including the Health Insurance Portability and Accountability Act (HIPAA).

The message is intended for the sole use of the individual or entity to whom it is addressed. If you are not the intended recipient, you are notified that any use, distribution or copying of the message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately by replying to this email and delete the material from any computer.


Back to: Top of message | Previous page | Main SAS-L page