BookmarkSubscribeRSS Feed
Rolf
Calcite | Level 5

Hi,

I want to analyze a mixed model for repeated measurements at months 1,3,6,9,12,18,24. Treatments are active1 active2, and placebo. The model will be adjusted for the 3 quantitative (baseline, age, duration of disease) and 3 dichotomous factors. Month is intentionally modeled as a categorical factor.

PROC MIXED ORDER=internal;

CLASS patid trt month covar1 covar2 covar3;

MODEL y= month

          age

          disdur

          trt trt*month

          baseline baseline*month

          covar1 covar1*month

          covar2 covar2*month

          covar3 covar3*month                / S DDFM=KR;

REPEATED month / TYPE=un SUBJECT=patid;

LSMEANS trt*month covar1*month covar2*month covar3*month/ CL DIFF E; 

I need to estimate LSM (s.e.) for the 3 treatment groups at Months 12 and Month 24. This I can do with a simple LSMEANS statement.

Question: How can I estimate the average LSM (s.e.) of the 2 active treatments?

The only way I can think of is to use the 'E' option in the LSMEANS statement to save the all covariates' coefficients used for constructing least square means, write the coefficients into macro variables, and then run the model again with a fairly complex ESTIMATE statement to derive the LSM of the pooled active treatments.

Does anybody have a simpler solution?

6 REPLIES 6
data_null__
Jade | Level 19

You will need SAS 9.3 or higher.  The LSMESTIMATE statement "The LSMESTIMATE statement provides a mechanism for obtaining custom hypothesis tests among least squares means"

Rolf
Calcite | Level 5

OK, instead getting the coefficients for the quantitative outcomes from PROC MIXED I could retrieve them from PROC MEANS since the coefficients are the mean values.

Any ideas for an easier solution?

SteveDenham
Jade | Level 19

The timestamps seem to indicate you might have missed data_null's suggestion regarding LSMESTIMATE.  It is the handiest tool in the mixed model procedures in my opinion.

Steve Denham

Rolf
Calcite | Level 5

It seems that with LSMESTIMATE I can only get the overall LSM for trt 1&2 pooled but not the LSM at any level of a class variable. If I used time as a continuous covariate then

LSMESTIMATE trt 'Combined at M2' 0.5 0.5 0 / AT time=12;

probably would give me the estmate I want, but with timecat (instead time) as a class variable it doesn't work. Or am I missing something?

Rolf
Calcite | Level 5

yes, after all

LSMESTIMATE trt*month   0 0 0 0.5 0 0

                        0 0 0 0.5 0 0

                        0 0 0 0   0 0;

gave the same result as the 21 rows ESTIMATE statement I have been using so far.

I had thought that with the LSMESTIMATE statement only 1 effect (i.e. trt, but not trt*month) could be specified because I misinterperted the following statement in the SAS documentation "In contrast to a multirow estimate in the ESTIMATE statement, you specify only a single effect in the LSMESTIMATE statement".

Thanks, now I can shorten the code.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 6 replies
  • 2295 views
  • 3 likes
  • 3 in conversation