Wednesday, June 16, 2010

Mean Graph with Standard Deviation Bars

************************************************************
Produce a mean graph with standard deviation bars with and
without showing plot points by using color commands
************************************************************

***Data is longitudinal in nature;

***Using SAS's symbol statement i=stdxxx, you can create a graph that will connect the mean of the y's on each x-axis point and produce standard deviation bars.;


symbol1 value=diamond i=std1jt color=black h=3;

***STD1jt=1 is 1 standard deviation, j=join together means, t=place tops and bottoms on the std dev bars;

axis1 order=(0 to 2000 by 500) minor=none label=(a=90 height=3 color=black "Mean Statistic");

axis2 order=(0 to 80 by 10) minor=none label=(height=3 color=black "Time (hr)");

proc gplot data=graphdata;
plot yvar*xvar/
vaxis=axis1
haxis=axis2;
run;
quit;

Using the following code, the graph produced looks like this:;




***Now, to take out the individual points, use color commands:;

symbol1 value=diamond i=std1jt cv=white ci=red co=black;

axis1 order=(0 to 2000 by 500) minor=none label=(a=90 height=3 color=black "Mean Statistic");

axis2 order=(0 to 80 by 10) minor=none label=(height=3 color=black "Time (hr)");

proc gplot data=graphdata;
plot yvar*xvar/
vaxis=axis1
haxis=axis2;
run;
quit;

***The graph produced would look like this:;



*/This works because:
COLOR=symbol-color | _style_ (or C=symbol-color) specifies a color for the entire definition, unless it is followed by a more explicit specification. For the GPLOT and GBARLINE procedures, this includes plot symbols, the plot line, confidence limit lines, and outlines.

CO=color specifies a color for staffs, boxes, and bars generated by the high-low interpolation methods: INTERPOL=HILO, INTERPOL=BOX, and INTERPOL=STD

CI=line-color|_style_ specifies a color for an interpolation line (GPLOT and GBARLINE) or a contour line (GCONTOUR).

CV=value-color|_style_ specifies a color for the plot symbols in the GPLOT procedure
/*

No comments:

Post a Comment