turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Diagnosing unnecessary "WARNING: Apparent symbolic...

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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:

%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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cau83

07-24-2013 09:28 AM

try changing %let modelspec=&modelname&j;

to

%let modelspec=&&modelname&j;

All Replies

Solution

07-24-2013
09:28 AM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cau83

07-24-2013 09:28 AM

try changing %let modelspec=&modelname&j;

to

%let modelspec=&&modelname&j;

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Linlin

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?

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cau83

07-24-2013 09:57 AM

first time resolves

&&modelname&j to &modelname1

second time resolves

&modelname1 to simple.