Hi, I am running a "Constrained Longitudinal Data Analysis" using PROC MIXED model with repeated measurements and a list of covariates (including both class and continuous ones) and am having problem writing the LSMEANS statement to output the lsmeans with specific condition for the covariates. The objective is to obtain the LS means for trtpn=1 at week2, at week 4, at week 8,.. and just use the means for the other covariates. Also want to obtain the LS means for trtpn=2 at week2, week4...., etc. Here is my data look like: *** For cLDA, need to create dummy trt variables for each week, only when trtpn=1 then these trt variables will be assigned as 1; data A; set A; if (trtpn=1 and week=2) then trtwk2=1; else trtwk2=0; if (trtpn=1 and week=4) then trtwk4=1; else trtwk4=0; if (trtpn=1 and week=8) then trtwk8=1; else trtwk8=0; if (trtpn=1 and week=12) then trtwk12=1;else trtwk12=0; if (trtpn=1 and week=16) then trtwk16=1;else trtwk16=0; if (trtpn=1 and week=20) then trtwk20=1;else trtwk20=0; run; I tried several codes in PROC MIXED and none worked yet. Below is one with no error message but the output is all missing: PROC MIXED DATA=A; CLASS subjid WEEK(ref=first) trtwk2 trtwk4 trtwk8 trtwk12 trtwk16 trtwk20 SOO UOR; by category2 category biomarker; MODEL LOG_VALUE_N = WEEK trtwk2 trtwk4 trtwk8 trtwk12 trtwk16 trtwk20 BALSFRS BASESLOPE TSS SOO UOR/SOLUTION DDFM=KENWARDROGER; REPEATED WEEK/SUBJECT=SUBJID TYPE=UN; estimate 'trt1 for week=2' trtwk2 1 week 1 0 0 0 0 0 ; estimate 'trt2 for week=2' trtwk2 0 week 1 0 0 0 0 0 ; ODS OUTPUT estimates=estimates; run; Here is another with error message: PROC MIXED DATA=adalsencals; CLASS subjid WEEK(ref=first) trtwk2 trtwk4 trtwk8 trtwk12 trtwk16 trtwk20 SOO UOR; by category2 category biomarker; MODEL LOG_VALUE_N = WEEK trtwk2 trtwk4 trtwk8 trtwk12 trtwk16 trtwk20 BALSFRS BASESLOPE TSS SOO UOR/SOLUTION DDFM=KENWARDROGER; REPEATED WEEK/SUBJECT=SUBJID TYPE=UN; LSMEANS WEEK*TRTWK2; RUN; ODS OUTPUT lsmeans=lsmeans; run; Please let me know how to write the statements in PROC MIXED to get the desired lsmeans? Thanks, Aurora
... View more