Color options in GPLOT in SAS -
i have temporal series variable in horizontal axis year. once have drawn gplot procedure want divide graphic in years painting each year in different color. have tried if statemente inside gplot procedure when defining color inside symbol options this
symbol
if year=2006 c=red;
(this simplified, depend on more years , stuff) desnt work.
edited: think didint explain myself properly.
have code
proc gplot data = work.datosipppa ; plot ipppa * date / overlay vaxis=axis1 haxis=axis2 frame legend=legend1 href='01jun2006'd '01jun2007'd ; plot2 tasaparomensual * date = 2 / overlay vaxis=axis3 overlay legend=legend1 ; run; quit;
and want colored each of years in different colour. want show graph cant if idont have 10 of reputation :(
in fact want somethng equal example http://support.sas.com/documentation/cdl/en/graphref/63022/html/default/viewer.htm#a003259878.htm instead of in procedure in gplot
one straightforward approach create list colors in goptions statement, this:
goptions reset=all colors=(red yellow green blue purple black); symbol value=dot; proc gplot data=sashelp.cars; plot horsepower * enginesize = type; run; quit;
you need review output years match colors want.
another way specify separate symbol statements each group plotting. try example below stripped down version of code. need create year variable , include in plot statement each year assigned different symbol statement / color.
goptions reset=all; *** generate test data ***; data have; date = '01jun2005'd '01aug2007'd; ipppa = ranuni(123456); tasaparomensual = 10 + rannor(123456) ; year = year(date); output; end; run; *** symbols 1-3 used in first plot statement symbolize 3 years in data ***; symbol1 value=dot color=red; symbol2 value=dot color=green; symbol3 value=dot color=yellow; *** symbols 4 used in plot2 statement ***; symbol4 value=star color=black i=join; proc gplot data=have; plot ipppa * date = year / href='01jun2006'd '01jun2007'd ; plot2 tasaparomensual * date ; run; quit;
hope helps.
Comments
Post a Comment