I can only suggest what I would do:
Sometimes it needs going back to Eyeball Mk 1.
When something works at first time and fails at second, or fails at first and works at second, it's about a 100% that there's some kind of uninitialized/spillover effect. That's why "side effects" in subroutines/macros etc are so dangerous.
Thanks, I've done that and I can see from the log that the code is using the parameters from the previous run. There's nothing in there that is standing out as a clue as to why though, so I'm a bit stumped!
I managed to stop it working at all by running this Macro first. I guess I'm now deleting the macro variables upfront, my problem is I'm then running the Macro before I've declared the variables. I don't follow what's causing that though.
%macro deleteALL;
options nonotes;
%local vars;
proc sql noprint;
select name into: vars separated by ' '
from dictionary.macros
where scope='GLOBAL'
and not name contains 'SYS_SQL_IP_';
quit;
%symdel &vars;
options notes;
%put NOTE: Macro variables deleted.;
%mend deleteALL;
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!
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.