1 The SAS System 08:17 Friday, November 23, 2001 NOTE: Copyright (c) 1999-2001 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software Release 8.2 (TS2M0) Licensed to UNC-CHAPEL HILL-SYSTEMWIDE-T/R, Site 0039466002. NOTE: This session is executing on the WIN_PRO platform. NOTE: SAS initialization used: real time 0.18 seconds cpu time 0.11 seconds 1 TITLE1 "STORE2.SAS--Demonstrate simple LINMOD use with stored code"; 2 3 *0. Define data file ; 4 5 FILENAME IN01 "..\EXAMPLES\PAYNE.DAT"; 6 DATA PAYNE; 7 INFILE IN01; 8 INPUT @7 GROUP $ INIT SCORE2 SCORE4 SCORE6 SCORE8 SCORE10; 9 * Create indicator variables ; 10 CONTROL = (GROUP="1"); 11 LOW = (GROUP="2"); 12 MODERATE= (GROUP="3"); 13 HIGH = (GROUP="4"); 14 NOTE: The infile IN01 is: File Name=D:\PROGRAMS\LINMOD33\EXAMPLES\PAYNE.DAT, RECFM=V,LRECL=256 NOTE: 45 records were read from the infile IN01. The minimum record length was 31. The maximum record length was 31. NOTE: The data set WORK.PAYNE has 45 observations and 11 variables. NOTE: DATA statement used: real time 0.02 seconds cpu time 0.02 seconds 15 PROC PRINT DATA=PAYNE; 16 17 * 1. Define directory in which LINMOD source code has been stored; 18 %LET LMDIRECT = ..\STORED\ ; 19 20 * 2. Define SAS macro code needed; 21 %INCLUDE "&LMDIRECT.MACROLIB.MAC" / NOSOURCE2 ; NOTE: Libref _LOAD01_ was successfully assigned as follows: Engine: V8 Physical Name: D:\PROGRAMS\LINMOD33\STORED\ 33 2 The SAS System 08:17 Friday, November 23, 2001 34 * 3. Reduce raw data to a TYPE=CORR file named _CORRDS_ 35 with characteristics required by LINMOD; 36 &PROCSSCP DATA=PAYNE ; NOTE: There were 45 observations read from the data set WORK.PAYNE. NOTE: The PROCEDURE PRINT printed page 1. NOTE: PROCEDURE PRINT used: real time 0.02 seconds cpu time 0.02 seconds 37 VAR CONTROL LOW MODERATE HIGH INIT 38 SCORE2 SCORE4 SCORE6 SCORE8 SCORE10; 39 40 * 4.1 Start IML with at least minimum space needed; 41 * Use SHOW SPACE statement and larger WORKSIZE, SYMSIZE values 42 to tune performance with bigger problems; NOTE: The data set WORK._CORRDS_ has 14 observations and 13 variables. NOTE: PROCEDURE CORR used: real time 0.01 seconds cpu time 0.01 seconds 43 PROC IML WORKSIZE=1000 SYMSIZE=1000; Worksize = 1024000 Symbol size = 1024000 NOTE: IML Ready 44 45 * 4.2 Initialize LINMOD IML code; 46 &LINMOD; NOTE: New storage library = _LOAD01_.LMSTORED 64 65 * 5. Retrieve the file _CORRDS_ created in Step 3 ; 66 RUN GETCORSS; 67 68 * 6. Define the model and estimate primary parameters; 69 INDVARS = { "CONTROL" "LOW" "MODERATE" "HIGH" "INIT" }; 70 DEPVARS=NAMELIST("SCORE",2,10,2); 71 *Last statement creates following matrix-- 72 *DEPVARS = { "SCORE2" "SCORE4" "SCORE6" "SCORE8" "SCORE10" }; 73 RUN FITMODEL; 74 75 * 7.1 Conduct a test (and estimation) step; 76 NOTE={"* MANOVA Test of Main Effect of Treatment, *" 77 , "* comparing each treatment group to the control group *" } ; 78 PRINT ,NOTE ; 79 C = { 1 -1 0 0 0 , 80 1 0 -1 0 0 , 81 1 0 0 -1 0 } ; 3 The SAS System 08:17 Friday, November 23, 2001 82 THETARNM= { "C-LOW" "C-MOD" "C-HIGH" }; 83 *U defaults to Identity matrix, if NROW(U)=0; 84 RUN TESTGLH; 85 86 * 7.2 Conduct another test (and estimation) step; 87 NOTE={"* Trends by Treatment Interaction, *" 88 , "* comparing each treatment group to the control group *" } ; 89 PRINT , NOTE ; 90 *Re-use the same C matrix; 91 *Note that all user inputs (C, U, THETA0, THETARNM, THETACNM, etc.) 92 are never changed by LINMOD, and hence remain in existence; 93 *May FREE THETACNM, for example, to avoid conflict 94 between successive invocations of TSTGLH; 95 TIMES ={2 4 6 8 10}; 96 RUN UPOLY1(TIMES ,"Time", 97 USCORE , SCORENM ); 98 U = USCORE; 99 THETACNM = SCORENM ; 100 RUN TESTGLH; NOTE: Exiting IML. NOTE: Storage library _LOAD01_.LMSTORED closed. NOTE: The PROCEDURE IML printed pages 2-8. NOTE: PROCEDURE IML used: real time 0.15 seconds cpu time 0.15 seconds NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 0.86 seconds cpu time 0.32 seconds