Happy New Year to you all.
I have the following in a macro containing proc report but it says - WARNING: Apparent symbolic reference BIGN1 not resolved. Same goes to BIGN2, BIGN3 and BIGN4.
data _null_;
set bign03(where=(cond1=&sub1 and cond2='&sub2'));
call symput('bign' || strip(put(tx,8.)), trim(left(put(bign,8.))));
run;
proc report ...;
...;
...;
define tx1 / display width=20 'A# N=%trim(&bign1)';
define tx2 / display width=20 'B# N=%trim(&bign2)';
define tx3 / display width=20 'B# N=%trim(&bign3)';
define tx4 / display width=20 ' Total# N=%trim(&bign4)';
...;
run;
I tested by conditioning on cond1=1 and cond2='A' and running it outside of the macro and it runs without this warning or errors.
I don't understand why. Could you please advise what have I not done right here?
Thanking you in advance.
Check your SAS log for the notes. In particular the notes from the DATA _NULL_ step that is creating the macro variables. It will most likely show that zero observations were read from the BIGN03 dataset.
That is because I suspect that you wanted the WHERE= dataset option to compare the value of the variable COND2 to the value of the macro variable SUB2. Instead you tested if the variable COND2 literally match the string '&sub2'. This is because macro code inside of single quotes is ignored. Use double quote characters instead.
data _null_;
set bign03 ;
where cond1=&sub1 and cond2="&sub2";
call symputx(cats('bign',tx),bign);
run;
proc report ... ;
define tx1 / display width=20 "A# N=&bign1";
define tx2 / display width=20 "B# N=&bign2";
define tx3 / display width=20 "B# N=&bign3";
define tx4 / display width=20 "Total# N=&bign4";
...
run;
Check your SAS log for the notes. In particular the notes from the DATA _NULL_ step that is creating the macro variables. It will most likely show that zero observations were read from the BIGN03 dataset.
That is because I suspect that you wanted the WHERE= dataset option to compare the value of the variable COND2 to the value of the macro variable SUB2. Instead you tested if the variable COND2 literally match the string '&sub2'. This is because macro code inside of single quotes is ignored. Use double quote characters instead.
data _null_;
set bign03 ;
where cond1=&sub1 and cond2="&sub2";
call symputx(cats('bign',tx),bign);
run;
proc report ... ;
define tx1 / display width=20 "A# N=&bign1";
define tx2 / display width=20 "B# N=&bign2";
define tx3 / display width=20 "B# N=&bign3";
define tx4 / display width=20 "Total# N=&bign4";
...
run;
Thanks @Tom for your quick response.
It is now working after replacing the single quote to double quotes.
Thanks again.
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.