TITLE1 "EXAMPLE2.SAS--Demonstrate LINMOD using MAKESS"; * 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 "C:\PROGRAMS\LINMOD31\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 = C:\PROGRAMS\LINMOD31\SOURCE\ ; *2. Define SAS macro's needed; %INCLUDE "&LMDIRECT.MACROLIB.MAC" / NOSOURCE2 ; * 3. Reduce raw data to a TYPE=CORR file. See Example 1; * Not done in this example due to using MAKESS; * 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=200 SYMSIZE=350; *4.2 Initialize LINMOD code; &LINMOD ; *5. Change and list options; OPT_OFF = { "MSH" }; OPT_ON = { "LISTINFO" "AVAILOPT" }; RUN SETOPT; *6.1 Read raw data into IML; * Use this approach only for small files; * Use PROCSSCP macro otherwise; USE PAYNE; READ ALL VAR{"GROUP"} INTO GROUP; READ ALL VAR{"INIT"} INTO INIT; READ ALL VAR{"SCORE2" "SCORE4" "SCORE6" "SCORE8" "SCORE10"} INTO Y; CLOSE PAYNE; *6.2 Use IML functions to create indicator variables for design matrix; N=NROW(Y); * # observations in sample; CONSTANT=J(N,1,1); *Column of 1's for intercept, etc; CELLMEAN=DESIGN(GROUP); *Cell mean coding; EFFECT =CONSTANT||DESIGNF(GROUP); *Effect coding; REFERENC=CONSTANT||CELLMEAN(|*,2:NCOL(CELLMEAN)|); *Reference cell coding; *Refer to IML manual for explanation of functions; *Use PROC PRINT and FREQ on GROUP to determine interpretation of BETA; *6.3 Assemble all predictors and responses into a single matrix, which must be called Z (to use MAKESS). ZNAMES must also exist, with 1 row, with values labeling the columns of Z ; Z = CELLMEAN || INIT || Y; ZNAMES = { "CONTROL" "LOW" "MODERATE" "HIGH" "INIT" } || { "SCORE2" "SCORE4" "SCORE6" "SCORE8" "SCORE10" } ; FREE GROUP INIT Y ; *7. Create SSCP matrix and associated parameters; RUN MAKESS; FREE Z; *Saves space, but if helpful, use PROCSSCP macro, not MAKESS; *8. Fit a model; INDVARS = { "CONTROL" "LOW" "MODERATE" "HIGH" "INIT" }; DEPVARS = { "SCORE2" "SCORE4" "SCORE6" "SCORE8" "SCORE10" }; RUN FITMODEL; *9. Conduct any testimation desired; *C= ---- ; *U= ---- ; *RUN TESTGLH;