I am trying to follow code in the SAS Certification Prep Guide: Statistical Business analyst, and it includes the following PROC REG code.
proc reg data=revenue; model revenue=adexpense; output out=diag predicted=yhat residual=residual stdr=stderr_resid student=student; plot residual.*adexpense modelht=3 statht=3; plot student.*adexpense modelht=3 statht=3; run;
But If I try and run this I get the following error
65 proc reg data=revenue; 66 model revenue=adexpense; 67 output out=diag predicted=yhat residual=residual stdr=stderr_resid student=student; 68 plot residual.*adexpense modelht=3 statht=3; - 79 76 NOTE: The previous statement has been deleted. 69 plot student.*adexpense modelht=3 statht=3; - 79 76 NOTE: The previous statement has been deleted. ERROR 79-322: Expecting a *. ERROR 76-322: Syntax error, statement will be ignored. 70 run;
I have tried adding and removing spaces but to no avail. Anyone understand what is wrong.
You might be interested in reading about the diagnostic plots that PROC REG can produce automatically.
Documentation: SAS Help Center: PROC REG Statement
For most SAS procedures, you just need to enable ODS graphics and use the PLOTS= option to ask the procedure to produce standard plots.
For plots that are not created automatically, you can often use the OUTPUT statement (as in your program) and then use PROC SGPLOT to create the plots.
The built-in ODS graphics do not contain all of the options on the PLOT statement, but the output looks much better. Good luck!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.