%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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.