BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Kurt_Bremser
Super User

I can only suggest what I would do:

  • start a fresh SAS session
  • run the code once
  • save the log to a file and clear it
  • run the code a second time
  • save the log again to a new file
  • compare the files in a suitable editor side-by-side, or use a code compare tool

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.

paulrockliffe
Obsidian | Level 7

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!

paulrockliffe
Obsidian | Level 7

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;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 3538 views
  • 0 likes
  • 2 in conversation