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 (December 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 18 Dec 2009 12:02:37 -0500
Reply-To:     "Simon, Lorna" <Lorna.Simon@UMASSMED.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Simon, Lorna" <Lorna.Simon@UMASSMED.EDU>
Subject:      Error bars and symbol statement
Content-Type: text/plain; charset=us-ascii

John - would this code be of any use to you? SAS support developed it for me.

/* PROC MEANS calculates the upper and lower confidence limits. */

proc means data=css2009.css2006_2007_2008_2009acmscales noprint;

class year;

var functioning_positive;

output out=functioning_means lclm=lclm uclm=uclm;

run; /* proc print; title2 "Meansout dataset"; run; */

/* Combine the statistics. */

data functioning_all;

merge functioning functioning_means;

by year; lower=lclm*100; upper=uclm*100; label pct_row="Percent Positive" year="Year"; run; /* proc print data=all; title2 "All dataset"; run; */

*Sas tech support's suggestion;

data functioning2;

set functioning_all;

where functioning_positive=1;

keep year pct_row lower upper;

run;

/* Create an annotate data set to draw the confidence limits. */

data functioning_anno;

length color function $8;

retain xsys ysys '2' hsys '4' when 'a' color 'red' size 1;

set functioning2;

/* Lower tick */

function='move'; xsys='2'; ysys='2'; midpoint=year; y=lower; output;

function='draw'; xsys='7'; ysys='2'; x=-2; y=lower; output;

function='draw'; xsys='7'; ysys='2'; x=+4; y=lower; output;

/* Upper tick */

function='move'; xsys='2'; ysys='2'; midpoint=year; y=upper; output;

function='draw'; xsys='7'; ysys='2'; x=-2; y=upper; output;

function='draw'; xsys='7'; ysys='2'; x=+4; y=upper; output;

/* Join upper and lower */

function='move'; xsys='2'; ysys='2'; midpoint=year; y=lower; output;

function='draw'; xsys='2'; ysys='2'; midpoint=year; y=upper; output;

run;

*proc print;

*run;

axis1 label=('Year');

axis2 label=('Percent postive');

axis3 LABEL=(' ');

title1 j=center height=14pt font=arial

"Figure 1.1. Consumer and Family Member Satisfaction Survey 2009" ;

title2 j=center height=14pt font=arial

"Percent of adults reporting positively about functioning, by survey year";

PROC gchart DATA=functioning2;

vbar year / sumvar=pct_row sum annotate=functioning_anno raxis=axis1; axis1 order=(0 to 100 by 10); run;

quit;

proc freq data= css2009.css2006_2007_2008_2009acmscales noprint;

tables year*soc_connect_positive / out=soc_connect outpct;

title1 "CSS 2009";

title2 "Social connectedness for Adults";

run;

/* PROC MEANS calculates the upper and lower confidence limits. */

proc means data=css2009.css2006_2007_2008_2009acmscales noprint;

class year;

var soc_connect_positive;

output out=soc_connect_means lclm=lclm uclm=uclm;

run; /* proc print; title2 "Meansout dataset"; run; */

/* Combine the statistics. */

data soc_connect_all;

merge soc_connect soc_connect_means;

by year; lower=lclm*100; upper=uclm*100; label pct_row="Percent Positive" year="Year"; run;

Date: Thu, 17 Dec 2009 15:20:26 -0800 From: John Uebersax <jsuebersax@GMAIL.COM> Subject: Error bars and symbol statement

I'm making a simple xy plot, where the x variable has discrete levels, with about 20 y values per x level.

Using proc gplot and the symbol statement (or some other option), can one plot instead of individual data points only mean y value per x, and error bars?

I know this is a simple question, but the documentation is akward.

I've been so far been able to add error bars -- but these overlay and are obscured by the actual data points. The goal is to plot the mean and error bars, not the points.

Thanks in advance for any tips.

John Uebersax


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