Hello all,
I am back on the forum after a long break, and happy to be SASing again!
I am now using SAS Studio 3.71 basic edition.
I guess I am a bit rusty, since I cannot find a solution for the following:
I have a simple design with two experimental conditions (COND), and multiple dependent variables (DV1, DV2, DV3, etc.). I assess the effect of COND via PROC MIXED using random factors. My goal is to produce a graph with the mean and error bars for all the DV, for the two levels of COND. All the DVs are on the same scale, so I would like them to appear in the same graph. Ideally, on the X asis, it would say DV1, DV2, DV3, and for each DV there are the two means with error bars, of different colors to differentiate the two levels of COND.
Since PROC MIXED doesn't allow for multiple DVs, I have given up trying to output them directly from it. I have looked into boxplot and sgplot, but am not finding a solution. I attach a drawing of what i would like.
Thank you in advance to anybody who may have a suggestion.
Best,
Emanuele
The VBAR command of PROC SGPLOT allows both clustered bar charts with statistical limits.
Dear Paige,
I have looked this up. I tried this one:
proc sgplot data=data;
dot cond / response=DV1, stat=mean
limitstat=stderr numstd=1;
run;
The problem is that I cannot indicate more than one RESPONSE, that is, DV, and I thus have to produce different graphs for each DV that I have. I tried:
response= (DV1 DV2)
and
response=DV1 DV2
and
response=DV1, DV2
But i get error messages. It doesnt seem like I can do it for more than one DVs at the time.
e
I have not looked at the DOT command in PROC SGPLOT.
In the VBAR command, you want to use the GROUP= option, along with GROUPDISPLAY=CLUSTER
VBAR works fine, and the GROUP= option would work if i had more than one "class" variable.
My issue is that I need to specify more than one DV, and the RESPONSE= doesn't allow for that.
e
You have to make the DV as a class variable that contains values DV1 or DV2 or DV3 etc.
Which probably means you will have to re-arrange your data set. If you show us a portion of the data, AS SAS DATA STEP CODE, we can advise further.
Thank you in advance!
I attach a portion of the dataset.
My company here does not want me opening .xlsx files on the internet, because it is a security risk.
Please provide a portion of the data as SAS DATA STEP CODE. I provided the link to do this in my earlier reply.
here it is in sas format
data re_arrange;
set sampledataset;
dv='DV1';
value=dv1;
output;
dv='DV2';
value=dv2;
output;
dv='DV3';
value=dv3;
output;
drop dv1 dv2 dv3;
run;
proc sgplot data=re_arrange;
vbar dv/response=value group=cond groupdisplay=clustered limitstat=clm stat=mean;
run;
Beautiful, it works. Thank you very much.
Emanuele
If I understand what you are attempting I would be tempted to either try
proc sgplot data=data; dot cond / response=DV1, stat=mean limitstat=stderr numstd=1; dot cond / response=DV2, stat=mean limitstat=stderr numstd=1; run;
with different marker options to tell the plots apart.
Or restructure the data so that you have separate records for the DV1 and DV2 with a variable indicating which type of record and use that new variable as a group variable.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.