I'm having trouble calling 3 different macros in a sequence within a data _null_ step. Here is a code snippet :
DATA _NULL_;
SET DATES;
if x = 'A' then call execute ('%runA('||rebal||')');
if x = 'B' then call execute ('%runB('||rebal||')');
if x = 'C' then call execute ('%runC('||rebal||')');
run;
Essentially x is in a sequence 'A','B','C','A','B','C','A','B','C','A','B','C'. Since the execute statement runs at the end of the data step there is no guarantee that the three steps are running in the right sequence. steps in %runB depend on %runA to complete and steps in %runC depend on %runB to complete...
Let me know ?
Hi @mgm,
The late Roland Rashleigh-Berry recommended to mask macro calls in CALL EXECUTE with %NRSTR in order to prevent premature execution: http://www.datasavantconsulting.com/roland/call_exec.html
So, you could try if
if x = 'A' then call execute ('%nrstr(%runA('||rebal||'))');
etc. works better.
Hi @mgm,
The late Roland Rashleigh-Berry recommended to mask macro calls in CALL EXECUTE with %NRSTR in order to prevent premature execution: http://www.datasavantconsulting.com/roland/call_exec.html
So, you could try if
if x = 'A' then call execute ('%nrstr(%runA('||rebal||'))');
etc. works better.
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.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.