Apparent symbolic reference not resolved for first run

Accepted Solution Solved
Reply
Contributor
Posts: 41
Accepted Solution

Apparent symbolic reference not resolved for first run

Hi All,

I'm using below code to get last month data set when I try to run first time it's giving error/warning and if I ran same code again it's running successfully and giving vales how to trouble shoot this first run issue. pls advise me. 

%LET JOBNAME=acardact_;

data _NULL_;

date1=intnx('MONTH',today(),-1,'SAMEDAY');

CALL SYMPUT("LOAD", TRIM(LEFT(PUT(DATE1, YYMMN6.))));

LOAD_T= "&JOBNAME"||"&LOAD";

CALL SYMPUT ("LOAD_DATE", LOAD_T);

%PUT &LOAD_DATE;

run;

Expecting value----- acardact_201401

LOG

124        %LET JOBNAME=acardact_;

125        data _NULL_;

126        date1=intnx('MONTH',today(),-1,'SAMEDAY');

127        CALL SYMPUT("LOAD", TRIM(LEFT(PUT(DATE1, YYMMN6.))));

128        LOAD_T= "&JOBNAME"||"&LOAD";

WARNING: Apparent symbolic reference LOAD not resolved.

129        CALL SYMPUT ("LOAD_DATE", LOAD_T);

130        %PUT &LOAD_DATE;

WARNING: Apparent symbolic reference LOAD_DATE not resolved.


Accepted Solutions
Solution
‎02-13-2014 06:59 AM
Super User
Posts: 5,441

Re: Apparent symbolic reference not resolved for first run

Posted in reply to chirumalla

You can't put a macro variable that doesn't even exist... + (&x).

A is a data step variable in your example, not a macro variable.

Data never sleeps

View solution in original post


All Replies
Super User
Posts: 5,441

Re: Apparent symbolic reference not resolved for first run

Posted in reply to chirumalla

Since macro variables are evaluated at compile time, date1 haven't been set at that time.

Just use data step variables, and then do call symput at the end.

Or just use macro code, not necessary to use a data step for this kind of logic.

Data never sleeps
Contributor
Posts: 41

Re: Apparent symbolic reference not resolved for first run

Hi

I tried this still I'm facing same issue pls help me how to resolve if possible give me code.

data _null_;

x = intnx('MONTH',today(),-1,'SAMEDAY');

%put &x;

run;

see below log

================================================

15         data _null_;

16         x = intnx('MONTH',today(),-1,'SAMEDAY');

17         %put &x;

WARNING: Apparent symbolic reference X not resolved.

&x

18         run;

Solution
‎02-13-2014 06:59 AM
Super User
Posts: 5,441

Re: Apparent symbolic reference not resolved for first run

Posted in reply to chirumalla

You can't put a macro variable that doesn't even exist... + (&x).

A is a data step variable in your example, not a macro variable.

Data never sleeps
Super User
Posts: 5,518

Re: Apparent symbolic reference not resolved for first run

Posted in reply to chirumalla

Move the RUN; statement to before the %PUT statement.  You have to force the DATA step to complete in order to create your macro variable.

🔒 This topic is solved and locked.

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

Discussion stats
  • 4 replies
  • 19922 views
  • 3 likes
  • 3 in conversation