01-23-2014 06:04 AM
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
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?
01-23-2014 06:39 AM
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"
01-23-2014 06:41 AM
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?
01-24-2014 12:59 PM
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.
02-03-2014 09:46 AM
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?
02-03-2014 10:31 AM
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.