11-09-2015 07:20 PM
How do I add an addtional predictional data while I perform a proc glm or gen mod?
For example: I am running a proc glm on a certain data from year 2008 to 2010 and I want the forecasts of 2011 seperately. I can do this in enterprise guide by going to 'predictions' and adding addtional data.
I'm aware one way is to extend the data from 2008 to 2011 and it will automatically add the forecasts but I wish to get them seperately.
Kindly provide suggestions.
Thank you in advance!
11-09-2015 07:27 PM
I guess I don't understand what it means "but I wish to get them seperately. "
Why can't you just perform the operation the way you described, and then separate the 2011 data from the earlier data?
11-09-2015 10:24 PM
If I recall accurately, GLM supports RUN groups. So use a WHERE statement to subset:
where (2008 <= year <= 2010);
Don't add a QUIT statement. To add data, change the WHERE statement and re-run:
where (2008 <= year <= 2011);
When you're totally done, finish with:
It's untested but if memory serves this should work. Good luck.
11-10-2015 04:48 PM
Correct me if I'm wrong!
We can use this only when 2008 to 2011 are present in the database right?
For example If I'm performing regression on data from 2005 to 2011 then I can use the statement where (2008<= year <= 2011) not when the data is from 2005 to 2007.
11-10-2015 05:16 PM
The WHERE statement will select the observations to use. So if your WHERE statement refers to a range of values that does not appear in your data set, well, you won't get anything useful. You won't get an error, but a regression based on 0 observations will not be helpful.
11-09-2015 11:33 PM
You can get predictions in separate sets by issuing multiple OUTPUT statements in separate run groups:
proc glm data=sashelp.class; model weight = height; output out=Males(where=(sex="M")) predicted=predWeight; run; output out=Females(where=(sex="F")) predicted=predWeight; run; quit;
Need further help from the community? Please ask a new question.