🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 11-02-2021 06:49 PM
(945 views)
It looks like sequence means 1 and 2 are being plotted as well as responseMeans * Period = sequence. How do I remove that dotted line and create a legend inside the plot?
data a;
input subject sequence $ period regimen $ result;
cards;
1 AB 1 A 15
1 AB 2 B 10
2 AB 1 A 14
2 AB 2 B 11
6 BA 1 B 11
6 BA 2 A 15
7 BA 1 B 10
7 BA 2 A 14
;
proc means data=a N mean stderr stddev lclm uclm NDEC=2 alpha=.05;
class sequence;
var result;
output out=MeanOut mean=Mean;
run;
proc means data=a N mean stderr stddev lclm uclm NDEC=2 alpha=.05;
class sequence period;
var result;
output out=MeanOut mean=Mean;
run;
title2 "Presummarized Data";
proc sgplot data=Meanout;
series x=period y=Mean / group=sequence;
scatter x=period y=Mean / group=sequence;
run;
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You run two PROC MEANS back to back with different CLASS statements and the same output name. Only the last data set remains the first isn't used anywhere. Is that what you're trying to do?
If you examine the output from the PROC MEANS in the MEANOUT data set you should notice that there's a variable in there called TYPE. When you specify a CLASS variable SAS summarizes it at all possible levels, so for two variables you end up with a three different type of summaries, the overall total (TYPE=0), overall for each variable SEQUENCE level overall, PERIOD level (with TYPE=1) and then for each Period*SEQUENCE interaction as well.
You can switch to BY instead of CLASS to avoid this or add the NWAY option to your PROC MEANS to sort this out.
proc means data=a NWAY N mean stderr stddev lclm uclm NDEC=2 alpha=.05;
class sequence period;
var result;
output out=MeanOut mean=Mean;
run;
If you examine the output from the PROC MEANS in the MEANOUT data set you should notice that there's a variable in there called TYPE. When you specify a CLASS variable SAS summarizes it at all possible levels, so for two variables you end up with a three different type of summaries, the overall total (TYPE=0), overall for each variable SEQUENCE level overall, PERIOD level (with TYPE=1) and then for each Period*SEQUENCE interaction as well.
You can switch to BY instead of CLASS to avoid this or add the NWAY option to your PROC MEANS to sort this out.
proc means data=a NWAY N mean stderr stddev lclm uclm NDEC=2 alpha=.05;
class sequence period;
var result;
output out=MeanOut mean=Mean;
run;
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You run two PROC MEANS back to back with different CLASS statements and the same output name. Only the last data set remains the first isn't used anywhere. Is that what you're trying to do?
If you examine the output from the PROC MEANS in the MEANOUT data set you should notice that there's a variable in there called TYPE. When you specify a CLASS variable SAS summarizes it at all possible levels, so for two variables you end up with a three different type of summaries, the overall total (TYPE=0), overall for each variable SEQUENCE level overall, PERIOD level (with TYPE=1) and then for each Period*SEQUENCE interaction as well.
You can switch to BY instead of CLASS to avoid this or add the NWAY option to your PROC MEANS to sort this out.
proc means data=a NWAY N mean stderr stddev lclm uclm NDEC=2 alpha=.05;
class sequence period;
var result;
output out=MeanOut mean=Mean;
run;
If you examine the output from the PROC MEANS in the MEANOUT data set you should notice that there's a variable in there called TYPE. When you specify a CLASS variable SAS summarizes it at all possible levels, so for two variables you end up with a three different type of summaries, the overall total (TYPE=0), overall for each variable SEQUENCE level overall, PERIOD level (with TYPE=1) and then for each Period*SEQUENCE interaction as well.
You can switch to BY instead of CLASS to avoid this or add the NWAY option to your PROC MEANS to sort this out.
proc means data=a NWAY N mean stderr stddev lclm uclm NDEC=2 alpha=.05;
class sequence period;
var result;
output out=MeanOut mean=Mean;
run;