Hi SAS Users,
I am new for proc mixed procedure. I have repeated data with 8 follow-up visit including baseline. I genearte a similar data set as below.
I want to use proc mixed to do the analysis and compare only each follow-up visit to baseline adjusitng with tukey method.
Could you kindly help me to figure out what code should I insert or midify?
Thank you.
data forglm(keep=person gender y1-y4) formixed(keep=person gender visit y); input person gender$ y1-y4; output forglm; y=y1; visit=1; output formixed; y=y2; visit=2; output formixed; y=y3; visit=3; output formixed; y=y4; visit=4; output formixed; datalines; 1 F 21.0 20.0 21.5 23.0 2 F 21.0 21.5 24.0 25.5 3 F 20.5 24.0 24.5 26.0 4 F 23.5 24.5 25.0 26.5 5 F 21.5 23.0 22.5 23.5 6 F 20.0 21.0 21.0 22.5 7 F 21.5 22.5 23.0 25.0 8 F 23.0 23.0 23.5 24.0 9 F 20.0 21.0 22.0 21.5 10 F 16.5 19.0 19.0 19.5 11 F 24.5 25.0 28.0 28.0 12 M 26.0 25.0 29.0 31.0 13 M 21.5 22.5 23.0 26.5 14 M 23.0 22.5 24.0 27.5 15 M 25.5 27.5 26.5 27.0 16 M 20.0 23.5 22.5 26.0 17 M 24.5 25.5 27.0 28.5 18 M 22.0 22.0 24.5 26.5 19 M 24.0 21.5 24.5 25.5 20 M 23.0 20.5 31.0 26.0 21 M 27.5 28.0 31.0 31.5 22 M 23.0 23.0 23.5 25.0 23 M 21.5 23.5 24.0 28.0 24 M 17.0 24.5 26.0 29.5 25 M 22.5 25.5 25.5 26.0 26 M 23.0 24.5 26.0 30.0 27 M 22.0 21.5 23.5 25.0 ;
data formixed2;
set formixed;
by person;
if first.person then base = y;
base +0;
diff = y - base;
output;
run;
proc mixed data=formixed2;
class gender visit person;
model y = base visit ;
repeated / type=cs sub=person;
/*insert appropriate code for paired comparison with tukey adjustment*/
run;
I used dunnett adjustement and upadted the code. It should produce what I want. I also use tukey to compare.
proc mixed data=formixed2; class gender visit person; model y = base visit ; repeated / type=cs sub=person; lsmeans visit/diff adjust = DUNNETT; lsmeans visit/diff adjust = tukey; run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.