134 ****** A_R4.sas, from the old ST210A_R; 135 136 options formdlim = '-'; 137 138 filename sa_rlst 'c:\stat210\sasjobs\jl2003\a_r4lst.pdf'; 139 ods printer pdf file=sa_rlst; NOTE: Writing ODS PRINTER output to DISK destination "c:\stat210\sasjobs\jl2003\a_r4lst.pdf", printer "PDF". 140 141 options dquote; 142 143 %macro runloess (data=_last_,out=,x=,y=,f=0.5); 144 proc loess data=&data; 145 model &y = &x /smooth=&f; 146 ods output OutputStatistics=&out; 147 title2 "smoothed plot of &y versus &x with smooth &f"; 148 proc plot; by SmoothingParameter; 149 plot DepVar*&x='*' Pred*&x='+' / overlay; 150 run; 151 %mend; 152 153 TITLE1 'FITNESS DATA EXAMPLE FROM SAS MANUALS'; 154 NOTE: There were 10 observations read from the data set WORK.GROUP. NOTE: PROCEDURE PLOT used: real time 1:06.93 cpu time 0.37 seconds 155 DATA FITNESS; 156 INPUT AGE WEIGHT OXY RUNTIME RSTPULSE RUNPULSE MAXPULSE; 157 LOXY=LOG(OXY); 158 LRUNTIME = LOG(RUNTIME); 159 CARDS; NOTE: The data set WORK.FITNESS has 31 observations and 9 variables. NOTE: DATA statement used: real time 0.00 seconds cpu time 0.00 seconds 191 ; 192 PROC SORT; BY OXY; NOTE: There were 31 observations read from the data set WORK.FITNESS. NOTE: The data set WORK.FITNESS has 31 observations and 9 variables. NOTE: PROCEDURE SORT used: real time 0.01 seconds cpu time 0.01 seconds 193 PROC PRINT; 194 TITLE2 'SORTED BY OXYGEN CAPACITY (OXY)'; 195 NOTE: There were 31 observations read from the data set WORK.FITNESS. NOTE: PROCEDURE PRINT used: real time 0.14 seconds cpu time 0.03 seconds 196 PROC UNIVARIATE FREQ NORMAL PLOT; 197 VAR AGE WEIGHT RUNTIME RSTPULSE RUNPULSE MAXPULSE OXY; 198 TITLE2 'UNIVARIATE DISTRIBUTIONS'; NOTE: PROCEDURE UNIVARIATE used: real time 2.26 seconds cpu time 0.20 seconds 199 PROC CORR pearson spearman nosimple; 200 VAR AGE WEIGHT RSTPULSE RUNPULSE MAXPULSE RUNTIME OXY; 201 TITLE2 'BIVARIATE SIMPLE (Pearson) AND RANK (Spearman) CORRELATIONS'; 202 203 %runloess (data=fitness,out=smooth,x=age,y=oxy,f=0.3 0.5 0.7); NOTE: PROCEDURE CORR used: real time 0.14 seconds cpu time 0.04 seconds NOTE: The data set WORK.SMOOTH has 93 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.35 seconds cpu time 0.04 seconds 204 %runloess (data=fitness,out=smooth,x=weight,y=oxy,f=0.5); NOTE: There were 93 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.25 seconds cpu time 0.04 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.17 seconds cpu time 0.03 seconds 205 %runloess (data=fitness,out=smooth,x=rstpulse,y=oxy,f=0.5); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.09 seconds cpu time 0.00 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.17 seconds cpu time 0.00 seconds 206 %runloess (data=fitness,out=smooth,x=runpulse,y=oxy,f=0.5); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.06 seconds cpu time 0.01 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.15 seconds cpu time 0.03 seconds 207 %runloess (data=fitness,out=smooth,x=maxpulse,y=oxy,f=0.5); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.07 seconds cpu time 0.01 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.17 seconds cpu time 0.04 seconds 208 %runloess (data=fitness,out=smooth,x=runtime,y=oxy,f=0.5); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.09 seconds cpu time 0.01 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.18 seconds cpu time 0.03 seconds 209 NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.07 seconds cpu time 0.00 seconds 210 PROC REG DATA = FITNESS; 211 MODEL OXY=AGE; 212 MODEL OXY=WEIGHT; 213 MODEL OXY=RSTPULSE; 214 MODEL OXY=RUNPULSE; 215 MODEL OXY=MAXPULSE; 216 TITLE2 'UNIVARIATE LINEAR REGRESSIONS WITH OXY'; 217 NOTE: 31 observations read. NOTE: 31 observations used in computations. NOTE: PROCEDURE REG used: real time 0.46 seconds cpu time 0.04 seconds 218 PROC SORT DATA=FITNESS; BY RUNTIME; NOTE: There were 31 observations read from the data set WORK.FITNESS. NOTE: The data set WORK.FITNESS has 31 observations and 9 variables. NOTE: PROCEDURE SORT used: real time 0.01 seconds cpu time 0.01 seconds 219 DATA TIMES; 220 KEEP RUNTIME LRUNTIME; 221 DO J = 8 TO 14 BY 0.1; 222 RUNTIME = J; LRUNTIME = LOG(RUNTIME); 223 OUTPUT; 224 END; NOTE: The data set WORK.TIMES has 61 observations and 2 variables. NOTE: DATA statement used: real time 0.00 seconds cpu time 0.00 seconds 225 PROC SORT; BY RUNTIME; 226 NOTE: There were 61 observations read from the data set WORK.TIMES. NOTE: The data set WORK.TIMES has 61 observations and 2 variables. NOTE: PROCEDURE SORT used: real time 0.01 seconds cpu time 0.01 seconds 227 DATA NEW; MERGE FITNESS TIMES; BY RUNTIME; NOTE: There were 31 observations read from the data set WORK.FITNESS. NOTE: There were 61 observations read from the data set WORK.TIMES. NOTE: The data set WORK.NEW has 92 observations and 9 variables. NOTE: DATA statement used: real time 0.00 seconds cpu time 0.00 seconds 228 PROC PRINT; VAR RUNTIME LRUNTIME OXY; 229 TITLE2 'AUGMENTED DATA SET WITH ADDITIONAL VALUES OF RUNTIME'; 230 NOTE: There were 92 observations read from the data set WORK.NEW. NOTE: PROCEDURE PRINT used: real time 0.31 seconds cpu time 0.06 seconds 231 PROC REG lineprinter; MODEL OXY=RUNTIME / SPEC P R CLM CLI; 232 OUTPUT OUT=FIT R=RES STUDENT=SRES P=YPRED; 233 PLOT OXY*RUNTIME = '*' 234 P. *RUNTIME = '+' 235 L95M.*RUNTIME = '-' 236 U95M.*RUNTIME = '-' 237 L95. *RUNTIME = '-' 238 U95. *RUNTIME = '-' 239 / overlay; 240 TITLE2 'UNIVARIATE LINEAR REGRESSION OF RUNTIME WITH OXY'; 241 NOTE: 92 observations read. NOTE: 61 observations have missing values. NOTE: 31 observations used in computations. NOTE: The data set WORK.FIT has 92 observations and 12 variables. NOTE: PROCEDURE REG used: real time 1.14 seconds cpu time 0.12 seconds 242 DATA FIT; SET FIT; 243 IF OXY NE .; 244 NOTE: There were 92 observations read from the data set WORK.FIT. NOTE: The data set WORK.FIT has 31 observations and 12 variables. NOTE: DATA statement used: real time 0.00 seconds cpu time 0.00 seconds 245 PROC UNIVARIATE NORMAL PLOT; VAR RES; 246 247 %runloess (DATA=FIT,OUT=SMOOTH,X=RUNTIME,Y=RES, F=0.5); NOTE: PROCEDURE UNIVARIATE used: real time 0.38 seconds cpu time 0.03 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.23 seconds cpu time 0.01 seconds 248 %runloess (DATA=FIT,OUT=SMOOTH,X=RUNTIME,Y=SRES, F=0.5); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.09 seconds cpu time 0.01 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.29 seconds cpu time 0.04 seconds 249 %runloess (DATA=FIT,OUT=SMOOTH,X=YPRED ,Y=RES, F=0.5); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.09 seconds cpu time 0.01 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.32 seconds cpu time 0.01 seconds 250 NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.09 seconds cpu time 0.01 seconds 251 data fit; set fit; NOTE: There were 31 observations read from the data set WORK.FIT. NOTE: The data set WORK.FIT has 31 observations and 12 variables. NOTE: DATA statement used: real time 0.00 seconds cpu time 0.00 seconds 252 proc rank groups=10 out=predgrp; var ypred; ranks predgrp; NOTE: The data set WORK.PREDGRP has 31 observations and 13 variables. NOTE: PROCEDURE RANK used: real time 0.01 seconds cpu time 0.01 seconds 253 proc sort; by predgrp; NOTE: There were 31 observations read from the data set WORK.PREDGRP. NOTE: The data set WORK.PREDGRP has 31 observations and 13 variables. NOTE: PROCEDURE SORT used: real time 0.00 seconds cpu time 0.00 seconds 254 proc means data=predgrp N mean var noprint; var res; by predgrp; 255 output out=vargroup var=vargroup; NOTE: There were 31 observations read from the data set WORK.PREDGRP. NOTE: The data set WORK.VARGROUP has 10 observations and 4 variables. NOTE: PROCEDURE MEANS used: real time 0.00 seconds cpu time 0.00 seconds 256 proc means data = predgrp N mean var noprint; var ypred; by predgrp; 257 output out=meangroup mean=meangroup; NOTE: There were 31 observations read from the data set WORK.PREDGRP. NOTE: The data set WORK.MEANGROUP has 10 observations and 4 variables. NOTE: PROCEDURE MEANS used: real time 0.01 seconds cpu time 0.01 seconds 258 data group; merge meangroup vargroup; by predgrp; NOTE: There were 10 observations read from the data set WORK.MEANGROUP. NOTE: There were 10 observations read from the data set WORK.VARGROUP. NOTE: The data set WORK.GROUP has 10 observations and 5 variables. NOTE: DATA statement used: real time 0.00 seconds cpu time 0.00 seconds 259 proc print; var predgrp meangroup vargroup; NOTE: There were 10 observations read from the data set WORK.GROUP. NOTE: PROCEDURE PRINT used: real time 0.09 seconds cpu time 0.03 seconds 260 proc plot; plot vargroup*meangroup; 261 run; 262 263 RUN; 264 265 ods printer close; NOTE: ODS PRINTER printed 75 pages to c:\stat210\sasjobs\jl2003\a_r4lst.pdf. 266 RUN;