DATA Step, Macro, Functions and more

Diagnosing unnecessary "WARNING: Apparent symbolic reference not resolved."

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 80
Accepted Solution

Diagnosing unnecessary "WARNING: Apparent symbolic reference not resolved."

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:

%macro modeltest(Dept=,holdoutweeks=);

  %let modelname1=simple;

  %let modelname2=double;

  %let modelname3=linear;

  %let modelname4=damptrend;

  %let modelname5=addseasonal;

  %let modelname6=multseasonal;

  %let modelname7=winters;

  %let modelname8=addwinters;

  %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;

            run;

       %end;

  %end;

%mend;

%modeltest(Dept=OSS,holdoutweeks=6);

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.

-Chris


Accepted Solutions
Solution
‎07-24-2013 09:28 AM
Super Contributor
Posts: 1,636

Re: Diagnosing unnecessary "WARNING: Apparent symbolic reference not resolved."

try changing %let modelspec=&modelname&j;

to

%let modelspec=&&modelname&j;

View solution in original post


All Replies
Solution
‎07-24-2013 09:28 AM
Super Contributor
Posts: 1,636

Re: Diagnosing unnecessary "WARNING: Apparent symbolic reference not resolved."

try changing %let modelspec=&modelname&j;

to

%let modelspec=&&modelname&j;

Frequent Contributor
Posts: 80

Re: Diagnosing unnecessary "WARNING: Apparent symbolic reference not resolved."

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?

Super Contributor
Posts: 1,636

Re: Diagnosing unnecessary "WARNING: Apparent symbolic reference not resolved."

first time resolves

&&modelname&j to  &modelname1

second time resolves

&modelname1 to simple.


🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

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