Hello, I have a list of macro variables specified as below
proc sql noprint;
select count(distinct date) into :Num_Dates from &ds1;
select distinct date into : Date1-:Date%left(&Num_Dates)
from &ds1;
quit;
Is there a way to delete Date1 etc without having to list of all of them I normally use %symdel Thank you!
Put your processing in a macro. All defined macro variables will become in the scope local.
When the macro execution stops all local variables are deleted automatic. Nothing to bother about deleting them.
yes I am doing that but just wanted to know if there was a way for my own reference Thanks!
There is a dictionary view and data step view of macro variables. You can use that to create the list of variable names you want to delete.
Here's an approach like _null_ suggested:
data _null_ ;
set sashelp.vmacro ;
where scope='GLOBAL' and offset=0 and name like "DATE%" ;
call execute('%nrstr(%%)symdel '||trim(left(name))||';') ;
run ;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.