TITLE1 "EXAMPLE1.SAS--Demonstrate simple LINMOD use"; * Data are from Danford, Hughes, and McNee, *; * "On the Analysis of Repeated Measurement Experiments," *; * Biometrics, 16, 1960, pp. 547-565. *; * 0. Define raw data file; FILENAME IN01 "..\EXAMPLES\PAYNE.DAT"; DATA PAYNE; INFILE IN01; INPUT @7 GROUP $ INIT SCORE2 SCORE4 SCORE6 SCORE8 SCORE10; * Create indicator variables ; CONTROL = (GROUP="1"); LOW = (GROUP="2"); MODERATE= (GROUP="3"); HIGH = (GROUP="4"); PROC PRINT DATA=PAYNE; * 1. Define directory in which LINMOD source code has been stored; %LET LMDIRECT = ..\SOURCE\ ; * 2. Define SAS macro code needed; %INCLUDE "&LMDIRECT.MACROLIB.MAC" / NOSOURCE2 ; * 3. Reduce raw data to a TYPE=CORR file named _CORRDS_ with characteristics required by LINMOD; &PROCSSCP DATA=PAYNE ; VAR CONTROL LOW MODERATE HIGH INIT SCORE2 SCORE4 SCORE6 SCORE8 SCORE10; * 4.1 Start IML with at least minimum space needed; * Use SHOW SPACE statement and larger WORKSIZE, SYMSIZE values to tune performance with bigger problems; PROC IML WORKSIZE=2000 SYMSIZE=3500; * 4.2 Initialize LINMOD IML code; &LINMOD ; * 4.3 Test new "NOPRINT" option; OPT_OFF = {NOPRINT}; RUN SETOPT; * 5. Retrieve the file _CORRDS_ created in Step 3 ; RUN GETCORSS; * 6. Define the model and estimate primary parameters; INDVARS = { "CONTROL" "LOW" "MODERATE" "HIGH" "INIT" }; DEPVARS=NAMELIST("SCORE",2,10,2); *Last statement creates following matrix-- *DEPVARS = { "SCORE2" "SCORE4" "SCORE6" "SCORE8" "SCORE10" }; RUN FITMODEL; * 7.1 Conduct a test (and estimation) step; NOTE={"* MANOVA Test of Main Effect of Treatment, *" , "* comparing each treatment group to the control group *" } ; PRINT ,NOTE ; C = { 1 -1 0 0 0 , 1 0 -1 0 0 , 1 0 0 -1 0 } ; THETARNM= { "C-LOW" "C-MOD" "C-HIGH" }; *U defaults to Identity matrix, if NROW(U)=0; RUN TESTGLH; * 7.2 Conduct another test (and estimation) step; NOTE={"* Trends by Treatment Interaction, *" , "* comparing each treatment group to the control group *" } ; PRINT , NOTE ; *Re-use the same C matrix; *Note that all user inputs (C, U, THETA0, THETARNM, THETACNM, etc.) are never changed by LINMOD, and hence remain in existence; *May FREE THETACNM, for example, to avoid conflict between successive invocations of TSTGLH; TIMES ={2 4 6 8 10}; RUN UPOLY1(TIMES ,"Time", USCORE , SCORENM ); U = USCORE; THETACNM = SCORENM ; RUN TESTGLH; SHOW NAMES;