BookmarkSubscribeRSS Feed
AmyS
Calcite | Level 5

I am working through the SAS Programming for R users e-Course and have reached the Linear Models section. The following is the code copied from the solution to the second exercise in this section, which is showing you how to use the STORE statement in various modelling procedures to store a model, followed by PROC PLM to make predictions based on your model: 

 

proc reg data=sp4r.bodyfat;
  model weight = height neck chest;
  store mymod;
run;quit;

proc plm restore=mymod;
  score data=sp4r.newdata_bodyfat_reg out=sp4r.pred_newdata_bodyfat predicted;
run;

proc print data=sp4r.pred_newdata_bodyfat;
  var weight height neck chest predicted;
run;

Although I don't get any errors, the STORE statement does not appear to be working (I also don't get any notes in my log about the STORE statement). The end result is a table with the correct data from newdata_bodyfat_reg, but a column of missing predicted values. I have looked in my work library, and there is no mymod file, which I believe I should be able to see. I also tried saving it to a different library, with the same results. I also tried running the demo example which has similar code, but uses a different dataset. Although it works in the demo video, again I ended up with a column of missing predicted values and no visible binary model file.

 

 

I am using SAS Studio 3.1 and SAS 9.4. This free course can be found here and the data can be found in Section 1.4.

 

Thanks for your help,

Amy

 

3 REPLIES 3
ballardw
Super User

Item stores are not by default displayed in the SAS explorer windows. You can verify that a store has been created by looking in the folder for mymod.bitm using operating system tools.

 

Without actual data it is hard to say what may be happening in your case. If the data set you are scoring has any missing value for any of the model independent variables (height neck chest) the predicted result would be missing. Of if the type of a variable is incorrect (character in the case of Proc Reg).

AmyS
Calcite | Level 5

ballardw - thanks for your helpful reply.

 

In fact, if I use Windows File Explorer, I can see mymod.bitm, so perhaps it is not the STORE statement where the problem lies.

 

The regression procedure also seems to work fine. Using it with an output statement followed by a univariate procedure, I can look at the model residuals:

ods select ANOVA FitStatistics ParameterEstimates;
proc reg data=sp4r.BodyFat;
	model Weight = Height Neck Chest;
	output out=PredWeight predicted=pred residual=res;
run;
quit;

ods select histogram qqplot;
proc univariate data=work.PredWeight;
	histogram res / normal;
	qqplot res / normal(mu=est sigma=est);
run;
quit;

SAS res srceenshot.png 

There's also no missing values in the file newdata_bodyfat_reg. The results of PROC PLM and PROC PRINT from the initial post are:

SAS plm screenshot.png

Like I pointed out as well, the code and data sets are from a SAS course and I am following exactly the instructions.

AmyS
Calcite | Level 5

I have now used the STORE statement in a PROC GLMSELECT step followed by PROC PLM. This has worked just fine. Perhaps it is something peculiar to using STORE in PROC REG on my machine/versions of SAS and STUDIO? 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1473 views
  • 0 likes
  • 2 in conversation