BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
MaryA_Marion
Lapis Lazuli | Level 10

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
Reeza
Super User
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;

View solution in original post

1 REPLY 1
Reeza
Super User
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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 437 views
  • 1 like
  • 2 in conversation