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 (July 2009, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 31 Jul 2009 11:41:06 -0400
Reply-To:   msz03@albany.edu
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Mike Zdeb <msz03@ALBANY.EDU>
Subject:   Re: Gplot & Symbols
Content-Type:   text/plain;charset=iso-8859-1

hi ... if I interpret the question correctly, you have an X-var (time) and a Y-var (response) and a third variable (?) that should control the symbol

if that's correct, here are a few suggestions, the first two require a slight tweak to the data ... X-var (height), Y-var (weight), 3rd-var (sex)

the last uses annotate to add the points to the line

* put data set in order by height (x-axis variable); proc sort data=sashelp.class out=class; by height; run;

* add new observations to the data set with the 3rd variable in the plot recoded; data class; set class; output; sex = 'A'; output; run;

goptions reset=all ftext='arial' htext=2 gunit=pct;

* 1st symbol draws the line (all points with sex='A') 2nd symbol used for females (all points with sex='F') 3rd symbol used for males (all points with sex='M') ; symbol1 i=join c=black; symbol2 h=2 f='marker' v='C' c=red; symbol3 h=2 f='marker' v='C' c=blue;

* one way to add the SYMBOL information to the plot; title1 h=3 'PLOT OF WEIGHT AS A FUNCTION OF HEIGHT' ls=2; title2 f='marker' c=red 'C ' f='arial' 'FEMALES ' f='marker' c=blue 'C ' f='arial' 'MALES';

proc gplot data=class; plot weight*height=sex / nolegend; run; quit;

* another way to add the SYMBOL information;

legend1 shape=symbol(1e-10,2)pct label=none value=(j=l 'GENDER: ' ' FEMALE' ' MALE') frame;

title1 h=3 'PLOT OF WEIGHT AS A FUNCTION OF HEIGHT' ls=2;

proc gplot data=class; plot weight*height=sex / legend=legend1; run; quit;

* or use annotate ... no need to tweak the data set; proc sort data=sashelp.class out=class; by height; run;

* the symbols for males and females in different colors; data points; retain xsys ysys '2' function 'label' style 'marker' text 'C' when 'a'; set class (rename=(height=x weight=y)); if sex eq 'M' then color='blue'; else color='red'; run;

symbol1 i=join c=black;

title1 h=3 'PLOT OF WEIGHT AS A FUNCTION OF HEIGHT' ls=2; title2 f='marker' c=red 'C ' f='arial' 'FEMALES ' f='marker' c=blue 'C ' f='arial' 'MALES';

proc gplot data=class annotate=points; plot weight*height / nolegend; run; quit;

-- Mike Zdeb U@Albany School of Public Health One University Place Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475

> I want to plot response rates across time for a number of studies. However I > would like to know if it is also possible to have the symbols indicate > whether a specific variable is either 0 or 1. I would like to do this > without labeling, i.e. varying symbol size. Is this possible? > > Is it possible to have two different symbols on one line? > > Thanks, > > Cara >


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