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 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 19 Mar 2003 16:13:15 -0600
Reply-To:   Larry Hoyle <lhoyle@KU.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Larry Hoyle <lhoyle@KU.EDU>
Organization:   University of Kansas Computing Services
Subject:   Re: "runny" Colors in Proc GMAP

Here is a small example that creates an "unclassed" map shaded proportionally to the response value. It uses the maps.us sample dataset.

You could also run proc fastclus to compute a small set of cluster means (e.g.7+-2) and map those values, shaded proportionally. The result would look a lot like the unclassed map, but with fewer values in the legend.

/* Example of a proportionally shaded map */ /* Larry Hoyle 19-March 2003 */

/* first create a sample dataset with a response variable */ proc sql; create table StateLat as select state, segment, max(y) as lat from maps.us group by state, segment; quit;

/* create a default map for comparison */ proc gmap map=maps.us data=StateLat; id state segment; choro lat; run;

/* create a shading value for proportional shading */ /* SAS can use 256 unique shades */ %let loshade=8; %let hishade=250; proc sql noprint;

/* first find the bounds or the original response variable */ select max(lat), min(lat) into :maxlat, :minlat from stateLat;

/* transform the response variable */ /* into integers in the range &loshade-&hishade */ /* this can be used to construct rgb color values */

create table StateLatShades as select state, segment, lat, round(&loshade+(&hishade-&loshade)*(lat-&minlat)/(&maxlat-&minlat),1) as ishade,

put(round(&loshade+(&hishade-&loshade)*(lat-&minlat)/(&maxlat-&minlat),1),he x2.) as ishadeHex from StateLat order by ishade;

/* generate a list of colors */ select distinct "CX"||ishadeHex||ishadeHex||"FF" into :shadeList separated by ' ' from StateLatShades;

/* create a cntlin to make a format for the integer values */ create table fmtCntlin as select "ishade" as fmtname, ishade as start, put(mean(lat),7.3) as label from StateLatShades group by ishade;

quit;

%put shades are: &shadeList;

proc format cntlin=fmtCntlin; run;

goptions colors=(&shadeList);

/* finally map the discrete integer values */ proc gmap map=maps.us data=StateLatShades; id state segment; choro ishade/discrete; format ishade ishade.; run; quit;

-- Larry Hoyle Policy Research Institute University of Kansas, Blake Hall 1541 Lilac Lane, Room 607 Lawrence, KS 66044-3177

_________________________________ | lat/long: 38.57.24 / 95.14.36 \ | --> * < | Voice: (785) 864-9110 | | FAX: (785) 864-3683 | | EMAIL: LarryHoyle@ku.edu | |___________________________________| http://www.ku.edu/pri

About that bumper sticker that demands "Question Authority": Who says so?

"Roman Kolbe" <roman.kolbe@VOEVERS.DE> wrote in message news:OF1F058BC7.FC64ACAC-ONC1256CEE.0051181A-C1256CEE.0051610D@voevers.de... > Hello sas-l, > > I'm using PROC GMAP to visualize my data on a map of Germany (inside > SAS/GRAPH). I can choose the colors by naming them directly in the > pattern-Statement. See my sas-code below: > > goptions reset = global > colors = (YELLOW ORANGE PINK RED GREEN BLUE GREY BLACK) > gunit=pct border > ftext=simplex ; > pattern1 color = yellow value = solid; > pattern2 color = orange value = solid; > pattern3 color = pink value=solid; > pattern4 color = red value=solid; > pattern5 color = green value=solid; > pattern6 color = blue value=solid; > pattern7 color = grey value =solid; > pattern8 color = black value=Solid; > > proc gmap map = spdstst2.germany_plz2000_wp > data = spdstst2.jw_daten_wp; > id plz5; > choro sh_kl / discrete; > run; > quit; > > But what I need is "runny colors", say from yellow to red, or from light > grey to dark grey, so that when I have to add another pattern I don't have > to change all the other pattern-statements. > > Any suggestions? > > Roman > > ======================================================= > > Verband öffentlicher Versicherer > Statistik HUKS > Hansaallee 177 > 40549 Düsseldorf > Tel.: (02 11) 45 54 - 240 > Fax: (02 11) 45 54 - 45 240 > e-mail: roman.kolbe@voevers.de > > > > > ********************************************************************** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > > This footnote also confirms that this email message has been swept by > MIMEsweeper for the presence of computer viruses. > > www.mimesweeper.com > **********************************************************************


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