Dear All,
I would like to draw vlines with mean and standard deviation, instead of standard errors. The below code gives me the vline with StdErr. Could anybody help me with this?
Thanks in advance!
* Plot ;
data temp;
set sashelp.cars;
if origin in ("Asia" , "Europe") then group= 1;
else group= 2;
if type= "Hybrid" then delete;
run;
proc sgplot data= temp;
vline Type /
response= EngineSize
stat= mean
markers
limitstat= stderr
group= group;
;
run;
* Summary Stat ;
proc sort data= temp; by type group ;
run;
proc means data= temp n sum mean std;
class type group ;
var EngineSize;
run;
When you want to use an "error" different than is supplied directly by a plot option then you need to calculate the value yourself, placing the upper and/or lower value into a different variable and use an option that allows specifying limit variables, which may mean a different type of plot.
data work.temp;
set sashelp.cars;
if origin in ("Asia" , "Europe") then group= 1;
else group= 2;
if type= "Hybrid" then delete;
run;
proc summary data=work.temp nway;
class type group;
var enginesize;
output out=work.summary
mean= std= /autoname;
run;
data work.plot;
set work.summary;
es_upper = enginesize_mean+ enginesize_stddev;
es_lower = enginesize_mean- enginesize_stddev;
run;
proc sgplot data=work.plot ;
series x=type y=enginesize_mean/group=group;
scatter x=type y=enginesize_mean/group=group
yerrorupper=es_upper
yerrorlower=es_lower
;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.