*File: C:\teaching\LDA\programs\cd4prog.sas; *Last Edit: 1/21/04; filename idat 'c:\collab\il2fu\sas old\il2u5b.dat'; title1 'Il2 Study - Repeated Measures Analyses of tcd4 (total CD4+ count)'; /* NOTES TO STUDENTS: Use "tcd4", the main outcome of interest, for HW1 (not "cd4" which is a percent of total lymphocytes). The time variable is labeled "mth". Please use only data from mths 1 to 12 (representing time after randomization) for HW1. This restriction is done in the data step. The treatment variable is "group" - "A" = IL-2, "B" = control. Subjects are indicated by "id". Note that the data structure provides one line per visit (time point). To provide balanced data, I eliminate data from 7 subjects (done in first data step). This program is not complete, but should get you started in doing the requested analyses. There are a lot of extra variables here. Maybe we'll use some of them later... */ data one; infile idat lrecl=190 missover; input date mmddyy8. p24 bdna tt10 pwn allo cd4 tcd4 cd8 tcd8 cd3 tcd3 wbc tgran hgb plts sgot sgpt ap tbili creat tsh mg na ca igg iga igm beta lipa amyl il2r hladr mth group $ id $; if id='26-59-94' or id='26-84-37' or id='27-22-39' or id='23-90-76' or id='25-98-38' or id='26-09-94' or id='26-65-48' then delete; if mth=-4 or mth=-2 then mth=0; if mth gt 0 and mth le 12; proc sort; by group id mth; *Get one (average) value per person; proc means noprint data=one; var tcd4; by group id; output out=mndat mean= tcd4m; proc ttest data=mndat; class group; var tcd4m; * Get the OLS slope for each person; proc reg data=one outest=slp; model tcd4 = mth / noprint; by group id; * Change variable name (of summary measure) from "mth" to "slope"; data slp2; set slp; slope = mth; drop _model_ _type_ _depvar_ mth; proc ttest data=slp2; class group; var slope; * Do repeated measures ANOVA; proc glm data=one; class group id mth; model tcd4 = group id(group) mth group*mth; test h=group e=id(group); run;