BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Babloo
Rhodochrosite | Level 12

I'm trying to create a new numeric variable PODVER via case when statement in DI studio as follows. When I exceute this code, I got error like 'Apparent symbolic reference not resolved'. reporting_date is a macro variable and it has values like 02JAN2018, 12OCT2019.... Could you please help me to resolve the issue?

 

 

(case 
  when NEW_RENEWAL_DAY_MONTH_YEAR=REPORTING_DATE_ddmon 
   and KNKATD='7'  
      then input("&reporting_date.",date9.)
   when input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2018"),date9.) > today() 
     then input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2018"),date9.) 
     else input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2019"),date9.) end) as PODVER length = 8 format = DATE9.

Log:

 

 

 

1595 (case when NEW_RENEWAL_DAY_MONTH_YEAR=REPORTING_DATE_ddmon and KNKATD='7' then
1595 ! input("&reporting_date.",date9.)
WARNING: Apparent symbolic reference REPORTING_DATE not resolved.
1596 when input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2018"),date9.) > today() then
1596 ! input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2018"),date9.)
1597 else input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2019"),date9.) end) as PODVER length = 8
1598 format = DATE9.
1599 from &SYSLAST

SYMBOLGEN: Macro variable SYSLAST resolves to WORK.W728Z2TN 
WARNING: Apparent symbolic reference REPORTING_DATE not resolved.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@Babloo wrote:

It is there. It is a global macro variable which I created at the beginning in user written transformation.


Put this code in your program immediately before the part with the problematic macro variable:

%put _global_;

That will display currently defined global macro variables and the values.

 

In addition to comments about existence of the variable this may be suboptimal coding in general:

 

then input("&reporting_date.",date9.)

unless you do not trust what ever is supposed to be making &reporting_date to be proper text in data9 format such as "18SEP2018".

 

Simpler would be

then "&reporting_date."d

 

View solution in original post

8 REPLIES 8
PaigeMiller
Diamond | Level 26

You are using a macro variable in your code (specifically &reporting_date), but no such macro variable exists.

--
Paige Miller
Babloo
Rhodochrosite | Level 12

It is there. It is a global macro variable which I created at the beginning in user written transformation.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I am afraid it is not:

WARNING: Apparent symbolic reference REPORTING_DATE not resolved.

That warning is clearly telling you that no macro variable REPORTING_DATE is present in scope at the point that code is run. 

Possibly its not in scope, don't know how DI integrates various components.

PaigeMiller
Diamond | Level 26

@Babloo wrote:

It is there. It is a global macro variable which I created at the beginning in user written transformation.


When I have the choice between believing a programmer who says he did something, or believing SAS, which says that the programmer didn't do that thing, I believe SAS.

 

You may think you have created a global macro variable by that name, but you have not done it properly.

--
Paige Miller
Kurt_Bremser
Super User

@Babloo wrote:

It is there. It is a global macro variable which I created at the beginning in user written transformation.


No, it isn't. In a dispute, SAS is always right, the programmer never. I can tell you this from 20 years experience.

ballardw
Super User

@Babloo wrote:

It is there. It is a global macro variable which I created at the beginning in user written transformation.


Put this code in your program immediately before the part with the problematic macro variable:

%put _global_;

That will display currently defined global macro variables and the values.

 

In addition to comments about existence of the variable this may be suboptimal coding in general:

 

then input("&reporting_date.",date9.)

unless you do not trust what ever is supposed to be making &reporting_date to be proper text in data9 format such as "18SEP2018".

 

Simpler would be

then "&reporting_date."d

 

ballardw
Super User

In addition to comments about existence of the variable this may be suboptimal coding in general:

 

then input("&reporting_date.",date9.)

unless you do not trust what ever is supposed to be making &reporting_date to be proper text in data9 format such as "18SEP2018".

 

Simpler would be

then "&reporting_date."d
miriamjamison
Calcite | Level 5

I know that this is a pretty old topic at this point but I was having the same problem and I resolved it myself.

 

I realized that I had not actually RUN my %let statements before attempting to use them further down in the program.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 68878 views
  • 11 likes
  • 6 in conversation