Programming the statistical procedures from SAS

LSMEANS for average of 2 treatment groups?

Reply
New Contributor
Posts: 4

LSMEANS for average of 2 treatment groups?

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?

Respected Advisor
Posts: 3,780

Re: LSMEANS for average of 2 treatment groups?

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"

New Contributor
Posts: 4

Re: LSMEANS for average of 2 treatment groups?

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?

Respected Advisor
Posts: 2,655

Re: LSMEANS for average of 2 treatment groups?

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

New Contributor
Posts: 4

Re: LSMEANS for average of 2 treatment groups?

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?

Respected Advisor
Posts: 3,780

Re: LSMEANS for average of 2 treatment groups?

trt*month?

New Contributor
Posts: 4

Re: LSMEANS for average of 2 treatment groups?

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.

Ask a Question
Discussion stats
  • 6 replies
  • 446 views
  • 3 likes
  • 3 in conversation