BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Buzzy_Bee
Quartz | Level 8

On this instructional document about PROC MIXED:

https://www.pharmasug.org/proceedings/2021/SA/PharmaSUG-2021-SA-062.pdf

They demonstrate the example below to create an output that shows Least Square Means and columns for Estimate, Standard Error, DF, Lower and Upper. I need all of those, but I also want the N statistic. Does anyone know if there is an option that can be added in so I can get N on this output please? Thanks.

ods output lsmeans=pb_lsmean diffs=pb_lsdiff;
 proc mixed data=qlqc2 method=reml covtest empirical;
by param;
class subjid trt visit;
model chg=base trt visit trt*visit;
random intercept/ subject=subjid;
repeated visit/ subject=subjid type=ar(1);
lsmeans trt*visit/ cl pdiff;
 run;
1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

You are going to have to merge the PROC MEANS output with the PROC MIXED output.  PROC SQL is probably the best tool for that.

 

SteveDenham

View solution in original post

5 REPLIES 5
data_null__
Jade | Level 19

Consider displaying  Univariate(PROC MEANS) and MIXED statistics in rows.  

Screenshot 2021-09-08 153918.png

Buzzy_Bee
Quartz | Level 8

I'm not sure what you mean by this. Industry convention requires statistics to be shown in tables where each statistic has a vertical column that displays the results and the treatments are listed horizontally in the table. If I displayed it vertically, no one would be able to read it or use in their reports.

Rick_SAS
SAS Super FREQ

Add the NObs table to your ODS OUTPUT statement:

ods output lsmeans=pb_lsmean diffs=pb_lsdiff nobs=pb_nobs;
Buzzy_Bee
Quartz | Level 8
That only shows me the number of observations in the data set though, which Proc Mixed already does by default. What I mean is, I need the N statistic. So in the LSM table where it shows Treatment Drug A and the Estimate, DF etc, I need an N column in there that would tell me there were say 100 for Drug A, and 120 for Drug B.
The Proc Means procedure shows N, so currently I'm creating a Proc Mixed followed by Proc Means to generate all of the statistics I need. But I wanted to create a nice, tidy table that shows them all together that I can easily copy and paste onto an MS Word document.
SteveDenham
Jade | Level 19

You are going to have to merge the PROC MEANS output with the PROC MIXED output.  PROC SQL is probably the best tool for that.

 

SteveDenham

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

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.

Discussion stats
  • 5 replies
  • 1176 views
  • 2 likes
  • 4 in conversation