NOTE: Copyright (c) 1999-2001 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software Release 8.2 (TS2M0) Licensed to GEORGE WASHINGTON UNIVERSITY-CAMPUSWIDE-T/R, Site 0001180006. NOTE: This session is executing on the WIN_ME platform. WARNING: Entry MRUWSAVE.WSAVE was restored. The entry's data may be truncated. NOTE: The catalog repair process is complete for SASUSER.PROFILE.CATALOG. NOTE: SAS initialization used: real time 1.86 seconds 1 ****** A_R5.sas from the old ST210A_R; 2 3 options formdlim = '-'; 4 5 filename sa_rlst 'c:\stat210\sasjobs\jl2003\a_r5lst.pdf'; 6 ods printer pdf file=sa_rlst; NOTE: Writing ODS PRINTER output to DISK destination "c:\stat210\sasjobs\jl2003\ a_r5lst.pdf", printer "PDF". 7 8 options dquote; 9 10 %macro runloess (data=_last_,out=,x=,y=,f=0.5); 11 proc loess data=&data; 12 model &y = &x /smooth=&f; 13 ods output OutputStatistics=&out; 14 title2 "smoothed plot of &y versus &x with smooth &f"; 15 proc plot; by SmoothingParameter; 16 plot DepVar*&x='*' Pred*&x='+' / overlay; 17 run; 18 %mend; 19 20 %macro resplot(data=_last_); 21 data fitit; set &data; 22 proc rank groups=10 out=predgrp; var pred; ranks predgrp; 23 proc sort; by predgrp; 24 proc means data=predgrp N mean var noprint; var res; by predgrp; 25 output out=vargroup var=vargroup; 26 proc means data = predgrp N mean var noprint; var pred; by predgrp; 27 output out=meangroup mean=meangroup; 28 data group; merge meangroup vargroup; by predgrp; 29 proc print; var predgrp meangroup vargroup; 30 proc plot; plot vargroup*meangroup; 31 run; 32 %mend; 33 34 TITLE1 'FITNESS DATA EXAMPLE FROM SAS MANUALS'; 35 36 DATA FITNESS; 37 INPUT AGE WEIGHT OXY RUNTIME RSTPULSE RUNPULSE MAXPULSE; 38 LOXY=LOG(OXY); 39 LRUNTIME = LOG(RUNTIME); 40 CARDS; NOTE: The data set WORK.FITNESS has 31 observations and 9 variables. NOTE: DATA statement used: real time 0.22 seconds 72 ; 73 PROC SORT; BY OXY; 74 75 *********************************************************************; 76 77 title2 'smoothed fit of OXY versus **log** runtime'; 78 %runloess (data=fitness,out=smooth,x=lruntime,y=oxy,f=0.5); 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.10 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.28 seconds 79 NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.05 seconds 80 PROC REG DATA=FITNESS lineprinter; 81 MODEL OXY=LRUNTIME / SPEC; 82 OUTPUT OUT=FITL R=RES P=PRED; 83 PLOT OXY*LRUNTIME = '*' 84 P. *LRUNTIME = '+' 85 / overlay; 86 TITLE2 'UNIVARIATE LINEAR REGRESSION OF **LOG** RUNTIME WITH OXY'; 87 NOTE: 31 observations read. NOTE: 31 observations used in computations. NOTE: The data set WORK.FITL has 31 observations and 11 variables. NOTE: PROCEDURE REG used: real time 0.54 seconds 88 PROC PLOT; 89 PLOT OXY*RUNTIME = '*' 90 PRED *RUNTIME = '+' 91 / OVERLAY; NOTE: There were 31 observations read from the data set WORK.FITL. NOTE: PROCEDURE PLOT used: real time 0.04 seconds 92 PROC UNIVARIATE NORMAL PLOT; VAR RES; 93 94 %runloess (DATA=FITL,OUT=SMOOTH,X=LRUNTIME,Y=RES, F=0.5); NOTE: PROCEDURE UNIVARIATE used: real time 0.06 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.37 seconds 95 96 %resplot(data=fitl); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.00 seconds NOTE: There were 31 observations read from the data set WORK.FITL. NOTE: The data set WORK.FITIT has 31 observations and 11 variables. NOTE: DATA statement used: real time 0.33 seconds NOTE: The data set WORK.PREDGRP has 31 observations and 12 variables. NOTE: PROCEDURE RANK used: real time 0.16 seconds NOTE: There were 31 observations read from the data set WORK.PREDGRP. NOTE: The data set WORK.PREDGRP has 31 observations and 12 variables. NOTE: PROCEDURE SORT used: real time 0.11 seconds 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.17 seconds 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.10 seconds 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.11 seconds NOTE: There were 10 observations read from the data set WORK.GROUP. NOTE: PROCEDURE PRINT used: real time 0.05 seconds 97 98 **********************************************************************; 99 100 title2 'smoothed fit of **log** OXY versus runtime'; 101 %runloess (data=fitness,out=smooth,x=runtime,y=loxy,f=0.5); NOTE: There were 10 observations read from the data set WORK.GROUP. NOTE: PROCEDURE PLOT used: real time 0.00 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.32 seconds 102 NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.00 seconds 103 PROC REG DATA=FITNESS lineprinter; 104 MODEL LOXY=RUNTIME / SPEC; 105 OUTPUT OUT=FITLL R=RES P=PRED; 106 PLOT LOXY*RUNTIME = '*' 107 P. *RUNTIME = '+' 108 / overlay; 109 TITLE2 'UNIVARIATE LINEAR REGRESSION OF RUNTIME WITH **LOG** OXY'; 110 NOTE: 31 observations read. NOTE: 31 observations used in computations. NOTE: The data set WORK.FITLL has 31 observations and 11 variables. NOTE: PROCEDURE REG used: real time 0.60 seconds 111 data fitLL; set fitLL; 112 predoxy=exp(pred); NOTE: There were 31 observations read from the data set WORK.FITLL. NOTE: The data set WORK.FITLL has 31 observations and 12 variables. NOTE: DATA statement used: real time 0.10 seconds 113 PROC PLOT; 114 PLOT OXY*RUNTIME = '*' 115 PREDoxy *RUNTIME = '+' 116 / OVERLAY; NOTE: There were 31 observations read from the data set WORK.FITLL. NOTE: PROCEDURE PLOT used: real time 0.05 seconds 117 PROC UNIVARIATE NORMAL PLOT; VAR RES; 118 119 %runloess (DATA=FITLL,OUT=SMOOTH,X=RUNTIME,Y=RES, F=0.5); NOTE: PROCEDURE UNIVARIATE used: real time 0.05 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.32 seconds 120 121 %resplot(data=fitLL); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.05 seconds NOTE: There were 31 observations read from the data set WORK.FITLL. NOTE: The data set WORK.FITIT has 31 observations and 12 variables. NOTE: DATA statement used: real time 0.26 seconds NOTE: The data set WORK.PREDGRP has 31 observations and 13 variables. NOTE: PROCEDURE RANK used: real time 0.17 seconds 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.16 seconds 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.15 seconds 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.17 seconds 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.16 seconds NOTE: There were 10 observations read from the data set WORK.GROUP. NOTE: PROCEDURE PRINT used: real time 0.05 seconds 122 123 ************************************************************; 124 125 title2 'smoothed fit of **log** oxy versus **log** runtime'; 126 %runloess (data=fitness,out=smooth,x=lruntime,y=loxy,f=0.5); NOTE: There were 10 observations read from the data set WORK.GROUP. NOTE: PROCEDURE PLOT used: real time 0.04 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.27 seconds 127 NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.04 seconds 128 PROC REG DATA=FITNESS lineprinter; 129 MODEL LOXY=LRUNTIME / SPEC; 130 OUTPUT OUT=FITLLL R=RES P=PRED; 131 PLOT LOXY*LRUNTIME = '*' 132 P. *LRUNTIME = '+' 133 / overlay; 134 TITLE2 'MODEL WITH LOG OF OXY AND LOG OF RUNTIME'; 135 NOTE: 31 observations read. NOTE: 31 observations used in computations. NOTE: The data set WORK.FITLLL has 31 observations and 11 variables. NOTE: PROCEDURE REG used: real time 0.55 seconds 136 DATA FITS; SET FITLLL; 137 PREDOXY = EXP(PRED); NOTE: There were 31 observations read from the data set WORK.FITLLL. NOTE: The data set WORK.FITS has 31 observations and 12 variables. NOTE: DATA statement used: real time 0.15 seconds 138 PROC PLOT; 139 PLOT OXY*RUNTIME = '*' 140 PREDOXY*RUNTIME = '+' 141 / OVERLAY; 142 NOTE: There were 31 observations read from the data set WORK.FITS. NOTE: PROCEDURE PLOT used: real time 0.00 seconds 143 PROC UNIVARIATE NORMAL PLOT; VAR RES; 144 145 %runloess (DATA=FITLLL,OUT=SMOOTH,X=LRUNTIME,Y=RES, F=0.5); NOTE: PROCEDURE UNIVARIATE used: real time 0.04 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.50 seconds 146 147 %resplot(data=fitLLL); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.04 seconds NOTE: There were 31 observations read from the data set WORK.FITLLL. NOTE: The data set WORK.FITIT has 31 observations and 11 variables. NOTE: DATA statement used: real time 0.27 seconds NOTE: The data set WORK.PREDGRP has 31 observations and 12 variables. NOTE: PROCEDURE RANK used: real time 0.16 seconds NOTE: There were 31 observations read from the data set WORK.PREDGRP. NOTE: The data set WORK.PREDGRP has 31 observations and 12 variables. NOTE: PROCEDURE SORT used: real time 0.22 seconds 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.16 seconds 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.16 seconds 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.17 seconds NOTE: There were 10 observations read from the data set WORK.GROUP. NOTE: PROCEDURE PRINT used: real time 0.00 seconds 148 149 RUN; 150 151 ods printer close; NOTE: ODS PRINTER printed 42 pages to c:\stat210\sasjobs\jl2003\a_r5lst.pdf. 152 RUN;