Prev: Proc GPLOT - Centering multi-line y-axis labels
Next: Proc QLIM and endogeneity with survey data
From: "Simon, Lorna" on 18 Dec 2009 12:02 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=3Dcss2009.css2006_2007_2008_2009acmscales noprint; class year; var functioning_positive; output out=3Dfunctioning_means lclm=3Dlclm uclm=3Duclm; run; /* proc print; title2 "Meansout dataset"; run;=20 */ /* Combine the statistics. */ data functioning_all; merge functioning functioning_means; by year; lower=3Dlclm*100; upper=3Duclm*100;=20 label pct_row=3D"Percent Positive" year=3D"Year"; run; =20 /* proc print data=3Dall; title2 "All dataset"; run;=20 */ *Sas tech support's suggestion; data functioning2; set functioning_all; where functioning_positive=3D1; keep year pct_row lower upper; run; =20 /* 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; =20 /* Lower tick */ function=3D'move'; xsys=3D'2'; ysys=3D'2'; midpoint=3Dyear; y=3Dlower; = output; function=3D'draw'; xsys=3D'7'; ysys=3D'2'; x=3D-2; y=3Dlower; output; function=3D'draw'; xsys=3D'7'; ysys=3D'2'; x=3D+4; y=3Dlower; output; =20 /* Upper tick */ function=3D'move'; xsys=3D'2'; ysys=3D'2'; midpoint=3Dyear; y=3Dupper; = output; function=3D'draw'; xsys=3D'7'; ysys=3D'2'; x=3D-2; y=3Dupper; output; function=3D'draw'; xsys=3D'7'; ysys=3D'2'; x=3D+4; y=3Dupper; output; =20 /* Join upper and lower */ function=3D'move'; xsys=3D'2'; ysys=3D'2'; midpoint=3Dyear; y=3Dlower; = output; function=3D'draw'; xsys=3D'2'; ysys=3D'2'; midpoint=3Dyear; y=3Dupper; = output; run; =20 *proc print; *run; =20 axis1 label=3D('Year'); axis2 label=3D('Percent postive'); axis3 LABEL=3D(' '); =20 title1 j=3Dcenter height=3D14pt font=3Darial "Figure 1.1. Consumer and Family Member Satisfaction Survey 2009" ; title2 j=3Dcenter height=3D14pt font=3Darial "Percent of adults reporting positively about functioning, by survey year"; =20 PROC gchart DATA=3Dfunctioning2; vbar year / sumvar=3Dpct_row sum annotate=3Dfunctioning_anno raxis=3Daxis1;=20 axis1 order=3D(0 to 100 by 10);=20 run; quit; proc freq data=3D css2009.css2006_2007_2008_2009acmscales noprint; tables year*soc_connect_positive / out=3Dsoc_connect outpct; title1 "CSS 2009"; title2 "Social connectedness for Adults"; run; =20 /* PROC MEANS calculates the upper and lower confidence limits. */ proc means data=3Dcss2009.css2006_2007_2008_2009acmscales noprint; class year; var soc_connect_positive; output out=3Dsoc_connect_means lclm=3Dlclm uclm=3Duclm; run; /* proc print; title2 "Meansout dataset"; run;=20 */ /* Combine the statistics. */ data soc_connect_all; merge soc_connect soc_connect_means; by year; lower=3Dlclm*100; upper=3Duclm*100;=20 label pct_row=3D"Percent Positive" year=3D"Year"; run; =20 Date: Thu, 17 Dec 2009 15:20:26 -0800 From: John Uebersax <jsuebersax(a)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
|
Pages: 1 Prev: Proc GPLOT - Centering multi-line y-axis labels Next: Proc QLIM and endogeneity with survey data |