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.
@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
You are using a macro variable in your code (specifically &reporting_date), but no such macro variable exists.
It is there. It is a global macro variable which I created at the beginning in user written transformation.
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.
@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.
@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.
@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
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
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.