********************************************************************************************************** * ODS lecture * **********************************************************************************************************; *let's use one of sas's built in datasets for the purpose of this demonstration; proc print data=sashelp.iris; where species="Virginica"; run; *let's look at the output from a linear regression of petal length on sepal length; proc reg data=sashelp.iris; model sepallength=petallength; where species="Virginica"; run; quit; *what if i want to save this?; ods rtf file='I:/School/Computing/demo.rtf'; proc reg data=sashelp.iris; model sepallength=petallength; where species="Virginica"; run; quit; ods rtf close; *what if I prefer a different style?; ods rtf file='I:/School/Computing/demo.rtf' style=journal; proc reg data=sashelp.iris; model sepallength=petallength; where species="Virginica"; run; quit; ods rtf close; *but wait... I want to do regression diagnostics; ods rtf file='I:/School/Computing/demo.rtf' style=journal; ods graphics on; proc reg data=sashelp.iris; model sepallength=petallength; where species="Virginica"; run; quit; ods graphics off; ods rtf close; *but I only want the diagnostics... I can output only this if only I could remember what's its called; ods html; ods graphics on; ods trace on/listing; proc reg data=sashelp.iris; model sepallength=petallength; where species="Virginica"; run; quit; ods trace off; ods graphics off; ods html close; *I can use either the name as is or the label in quotes; ods rtf file='I:/School/Computing/demo.rtf' style=journal; ods graphics on; ods select diagnosticspanel; *ods select "Fit Diagnostics"; proc reg data=sashelp.iris; model sepallength=petallength; where species="Virginica"; run; quit; ods graphics off; ods rtf close; *still too much - I can unpack this with plots=all; ods html; ods graphics on; ods trace on/listing; proc reg data=sashelp.iris plots=all; model sepallength=petallength; where species="Virginica"; run; quit; ods trace off; ods graphics off; ods html close; *now I can output any one graph - say rstudentbypredicted; ods rtf file='I:/School/Computing/demo.rtf' style=journal; ods graphics on; ods select rstudentbypredicted; proc reg data=sashelp.iris plots=all; model sepallength=petallength; where species="Virginica"; run; quit; ods graphics off; ods rtf close; *what if I want to do this myself - I can output to a dataset; proc reg data=sashelp.iris; model sepallength=petallength; where species="Virginica"; output out=resid rstudent=jackknife p=predicted cookd=cooksd h=hat; run; quit; *and plot it myself; ods rtf file='I:/School/Computing/demo.rtf' style=journal; symbol value=circle; axis1 label=(a=90 "RStudent") minor=none; axis2 label=("Predicted Value") minor=none; title h=1.0 "RStudent by Predicted for Sepal Length"; proc gplot data=resid; plot jackknife*predicted/vaxis=axis1 haxis=axis2 vref=(-1.96,1.96); run; quit; ods rtf close; *if I wanted to send this to publication, I might want a pdf instead; ods pdf file='I:/School/Computing/demo.pdf' style=journal; symbol value=circle; axis1 label=(a=90 "RStudent") minor=none; axis2 label=("Predicted Value") minor=none; title h=1.0 "RStudent by Predicted for Sepal Length"; proc gplot data=resid; plot jackknife*predicted/vaxis=axis1 haxis=axis2 vref=(-1.96,1.96); run; quit; ods pdf close;