dm "log; clear; odsresults; clear;"; options linesize=64 nonumber nodate; *********************************************************************; * AUTHOR: Chris Bilder *; * DATE: 4-27-16 *; * PURPOSE: Regression model for gpa data set *; *********************************************************************; *Will appear as the first line of every page of output; title1 "Chris Bilder, STAT 850"; *Read in the data set from a comma delimitted text file; data set1; infile "C:\data\gpa.csv" firstobs=2 delimiter=","; input HS College; run; title2 "The HS and College GPA data set"; proc print data=set1; run; ***********************************************************************; *Turns off automatic graphics from proc reg; title2 "Estimate model for gpa data"; proc reg data=set1; model College = HS; run; ods graphics off; title2 "Estimate model with graphics off"; proc reg data=set1; model College = HS; run; ods graphics on; *default; title2 "Estimate model with graphics off"; proc reg data=set1 plots=none; model College = HS; run; ***********************************************************************; *Demonstrate statements and options; title2 "Estimate model for GPA data"; proc reg data=set1 outest=out_set1 alpha=0.05 plots=none; MyModel: model College = HS / outseb clm p; run; *Verify calculations for 95% CI for E(Y) when x = 3.04 (first obs); data temp; SE = 0.0788; tvalue = quantile("t", 0.975, 18); yhat = 2.9489; lower = yhat - tvalue*SE; upper = yhat + tvalue*SE; run; title2 "Verification of CI calculations"; proc print data=temp; run; title2 "Information resulting from outest option"; proc print data=out_set1; run; title2 "Estimate model for GPA data"; proc reg data=set1 alpha=0.05 noprint; model College = HS ; output out=out_set1 p=yhat r=residual lclm=low uclm=up; run; title2 "Produced by the output statement"; proc print data=out_set1(obs=5); run; ***********************************************************************; * ODS; ods listing; *Output also goes to output window; ods trace on / listing; *Put ODS table names in output window; title2 "Estimate model for GPA data"; proc reg data=set1 plots=none; model College = HS; run; ods trace off; *ODS table names are no longer printed; ods listing close; *Output now only goes to Results Viewer; *Show how to extract the ODS set; title2 "Estimate model for GPA data"; proc reg data=set1 plots=none; *Cannot use noprint option!; model College = HS; ods output ParameterEstimates=ods_set1; run; title2 "ODS ParameterEstimates data set"; proc print data=ods_set1; run; *Notice the differences in the log window between the two proc reg calls; ods trace on; title2 "Estimate model for GPA data"; proc reg data=set1 plots=none; model College = HS; run; title2 "Estimate model for GPA data"; proc reg data=set1 plots=none; model College = HS / clm p; run; ods trace off; quit;