%macro p;
%let _1p = 184;
%mend p;
%p;
%put RESULT = &_1p.;
I am getting warning for above code as...
WARNING: Apparent symbolic reference _1P not resolved.
can anyone please help
Yes, because your _1p macro variable is local to the p macro
%macro p;
%global _1p ;
%let _1p = 184;
%mend p;
%p;
%put RESULT = &_1p.;
Yes, because your _1p macro variable is local to the p macro
%macro p;
%global _1p ;
%let _1p = 184;
%mend p;
%p;
%put RESULT = &_1p.;
If you want _1P to be available after the P macro finishes running the make sure it is NOT local to P.
%let _1p=BEFORE;
%p;
%put &=_1p;
You could modify the macro to force it to be GLOBAL if is doesn't already exist.
%macro p;
%if not %symexist(_1p) %then %global _1p;
%let _1p=from macro p;
%mend p;
Terminology correction: You macro call worked fine. It was the macro variable you tried to reference after the macro had finished running that was generating the warning.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.