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 16.25 seconds 1 ****** A_M.sas from the old ST210A_M; 2 3 filename sa_rlst 'c:\stat210\sasjobs\jl2003\a_mlst.pdf'; 4 ods printer pdf file=sa_rlst; NOTE: Writing ODS PRINTER output to DISK destination "c:\stat210\sasjobs\jl2003\ a_mlst.pdf", printer "PDF". 5 6 options dquote; 7 8 %macro runloess (data=_last_,out=,x=,y=,f=0.5); 9 proc loess data=&data; 10 model &y = &x /smooth=&f; 11 ods output OutputStatistics=&out; 12 title2 "smoothed plot of &y versus &x with smooth &f"; 13 proc plot; by SmoothingParameter; 14 plot DepVar*&x='*' Pred*&x='+' / overlay; 15 run; 16 %mend; 17 18 %macro resplot(data=_last_); 19 data fitit; set &data; 20 proc rank groups=10 out=predgrp; var ypred; ranks predgrp; 21 proc sort; by predgrp; 22 proc means data=predgrp N mean var noprint; var res; by predgrp; 23 output out=vargroup var=vargroup; 24 proc means data = predgrp N mean var noprint; var ypred; by predgrp; 25 output out=meangroup mean=meangroup; 26 data group; merge meangroup vargroup; by predgrp; 27 proc print; var predgrp meangroup vargroup; 28 proc plot; plot vargroup*meangroup; 29 run; 30 %mend; 31 32 TITLE1 'FITNESS DATA EXAMPLE FROM SAS MANUALS'; 33 34 DATA FITNESS; 35 INPUT AGE WEIGHT OXY RUNTIME RSTPULSE RUNPULSE MAXPULSE; 36 LOXY=LOG(OXY); 37 LRUNTIME = LOG(RUNTIME); 38 RUNTMAGE=RUNTIME*AGE; 39 CARDS; NOTE: The data set WORK.FITNESS has 31 observations and 10 variables. NOTE: DATA statement used: real time 1.21 seconds 71 ; 72 PROC PRINT; 73 NOTE: There were 31 observations read from the data set WORK.FITNESS. NOTE: PROCEDURE PRINT used: real time 0.71 seconds 74 PROC reg lineprinter ALL DATA=FITNESS outest=betas; 75 MODEL OXY=RUNTIME AGE WEIGHT RUNPULSE MAXPULSE RSTPULSE 76 /influence PARTIAL; 77 OUTPUT R=RES p=ypred student=stdres OUT=fit; 78 79 plot student.*age 80 student.*WEIGHT 81 student.*RUNTIME 82 student.*RUNPULSE 83 student.*MAXPULSE 84 student.*RSTPULSE 85 ; 86 TITLE2 'MULTIVARIATE LINEAR REGRESSION OF ALL COVARIATES WITH OXY'; 87 NOTE: 31 observations read. NOTE: 31 observations used in computations. NOTE: The data set WORK.BETAS has 1 observations and 12 variables. NOTE: The data set WORK.FIT has 31 observations and 13 variables. NOTE: PROCEDURE REG used: real time 3.78 seconds 88 PROC UNIVARIATE NORMAL PLOT; VAR RES; 89 90 %runloess (DATA=FIT,OUT=SMOOTH,X=ypred ,Y=RES, F=0.5); NOTE: PROCEDURE UNIVARIATE used: real time 0.26 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.54 seconds 91 %runloess (DATA=FIT,OUT=SMOOTH,X=ypred ,Y=STDRES, F=0.5); NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.22 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.44 seconds 92 93 %resplot(data=fit); 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.FIT. NOTE: The data set WORK.FITIT has 31 observations and 13 variables. NOTE: DATA statement used: real time 0.22 seconds NOTE: The data set WORK.PREDGRP has 31 observations and 14 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 14 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.32 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.11 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.15 seconds NOTE: There were 10 observations read from the data set WORK.GROUP. NOTE: PROCEDURE PRINT used: real time 0.00 seconds 94 NOTE: There were 10 observations read from the data set WORK.GROUP. NOTE: PROCEDURE PLOT used: real time 0.00 seconds 95 PROC reg lineprinter DATA=FITNESS; 96 MODEL OXY=RUNTIME WEIGHT RUNPULSE MAXPULSE RSTPULSE; 97 OUTPUT OUT=LESS_AGE R=OXYRES; 98 title2 'VALUE ADDED PARTIAL REGRESSION PLOTS FOR AGE'; 99 title3 'REGRESSION OF OXY ON OTHER VARIABLES LESS AGE'; 100 NOTE: 31 observations read. NOTE: 31 observations used in computations. NOTE: The data set WORK.LESS_AGE has 31 observations and 11 variables. NOTE: PROCEDURE REG used: real time 0.82 seconds 101 PROC reg lineprinter DATA=FITNESS; 102 MODEL AGE=RUNTIME WEIGHT RUNPULSE MAXPULSE RSTPULSE; 103 OUTPUT OUT=AGERES R=AGERES; 104 title3 'REGRESSION OF age ON OTHER VARIABLES'; 105 NOTE: 31 observations read. NOTE: 31 observations used in computations. NOTE: The data set WORK.AGERES has 31 observations and 11 variables. NOTE: PROCEDURE REG used: real time 0.72 seconds 106 DATA AGEPART; MERGE AGERES LESS_AGE; 107 title3 'runloess plot of oxyres (less age) vs. ageres'; 108 %runloess (DATA=AGEPART,OUT=SMOOTH,X=AGERES,Y=OXYRES,F=0.5); NOTE: There were 31 observations read from the data set WORK.AGERES. NOTE: There were 31 observations read from the data set WORK.LESS_AGE. NOTE: The data set WORK.AGEPART has 31 observations and 12 variables. NOTE: DATA statement used: real time 0.21 seconds NOTE: The data set WORK.SMOOTH has 31 observations and 5 variables. NOTE: PROCEDURE LOESS used: real time 0.33 seconds 109 110 RUN; 111 NOTE: There were 31 observations read from the data set WORK.SMOOTH. NOTE: PROCEDURE PLOT used: real time 0.04 seconds 112 PROC reg lineprinter DATA=FITNESS; 113 MODEL OXY=RUNTIME AGE RUNTMAGE; 114 age: test age=0, runtmage=0; 115 runtime: test runtime=0, runtmage=0; 116 TITLE2 'MODEL WITH INTERACTION EFFECT'; 117 NOTE: 31 observations read. NOTE: 31 observations used in computations. NOTE: PROCEDURE REG used: real time 0.38 seconds 118 PROC GLM DATA=FITNESS; 119 MODEL OXY=RUNTIME AGE WEIGHT RUNPULSE 120 RUNTIME*AGE RUNTIME*WEIGHT RUNTIME*RUNPULSE 121 AGE *WEIGHT AGE *RUNPULSE 122 WEIGHT *RUNPULSE 123 ; 124 TITLE2 'MODEL WITH MULTIPLE INTERACTION EFFECTS -- PROC GLM'; 125 126 RUN; 127 128 ods printer close; NOTE: ODS PRINTER printed 46 pages to c:\stat210\sasjobs\jl2003\a_mlst.pdf. 129 RUN;