07-24-2013 09:22 AM
My code is for testing forecasting models on a holdout sample in order to test and do forecast value added analysis so that we can do model selection. Using PROC ESM, we have 8 model choices and then we also need to perform a 2 week forecast for each of the 6 weeks (so I have a 1 to 8 loop for the model choices and a 1 to 6 loop for the weeks). Here's the code:
%do J = 1 %to 2; **loops through the 8 different model choices and does the 6 weeks of forecasting for each**;
%let modelspec=&modelname&j; (*********THE PROBLEM OCCURS HERE********)
%DO I = 1 %TO 1;
%let backpd=%eval((&holdoutweeks+1)*7 - (&i*7)); **backpd = # of days to go back but divided by i so it loops through one week at a time**;
proc esm data=&Dept back=&BackPd lead=14 seasonality=7 nooutall outfor=fcast_&Dept._&i._&modelspec outstat=metrics_&Dept._&i._&modelspec out=_null_;
by queue_nm lob;
id date interval=day zeromiss=left;
forecast effort/ model=&modelspec;
I get an unnecessary warning (or, it is necessary and I do not yet realize the impact it could have, hence my question) on the line where I ID'd a problem. I want &modelspec to step through the 8 models each time, so be equal to &modelname1 then &modelname2 and so on. I'll selectively copy and paste some lines from the log to show the warning and that (I believe) it is ultimately working anyway:
MLOGIC(MODELTEST): %LET (variable name is MODELSPEC)
WARNING: Apparent symbolic reference MODELNAME not resolved.
SYMBOLGEN: Macro variable J resolves to 1
SYMBOLGEN: Macro variable MODELSPEC resolves to &modelname1
It appears that SAS is evaluating "&modelname" first before evaluating the entire "&modelname&j". Should I be concerned about this warning and how can I get rid of it? Is there a different way to do the specification?
I am also having a problem with naming the output data sets, but I posted that separately here: https://communities.sas.com/thread/48073 . thanks for any help/ideas.
07-24-2013 09:37 AM
Linlin, that worked thanks.
Now I get in the log:
SYMBOLGEN: && resolves to &.
Just curious now: So the double ampersand tells SAS to... what exactly? How does this work?
Need further help from the community? Please ask a new question.