Programming the statistical procedures from SAS

STORE statement not working, but no errors

Reply
New Contributor
Posts: 3

STORE statement not working, but no errors

[ Edited ]

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

 

Super User
Posts: 13,563

Re: STORE statement not working, but no errors

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).

New Contributor
Posts: 3

Re: STORE statement not working, but no errors

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.

New Contributor
Posts: 3

Re: STORE statement not working, but no errors

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? 

Ask a Question
Discussion stats
  • 3 replies
  • 107 views
  • 0 likes
  • 2 in conversation