hello
how could I delete all macro variables defined by user during program execution
thanks in advance for your help
Regards
Nass
Hello,
You can take a look at the sashelp.vmacro view and adapt the following program to your needs.
%let x=1;
%let y=hello;
data _NULL_;
set sashelp.vmacro(where=(scope='GLOBAL'));
call execute(catx(' ','%nrstr(%symdel)',name,';'));
run;
Check out the `%symdel` statement, doc. here: https://documentation.sas.com/?docsetId=mcrolref&docsetTarget=p1vtk6flp9vpfzn14kkxolcnggzy.htm&docse...
All the best
Bart
you could try with something like this:
%let a = 1;
%let b = 2;
%let c = 3;
options notes source;
%macro symdelALL();
%local _OPTIONS_ _TEMPFILE_;
%let _OPTIONS_ = %sysfunc(getoption(notes)) %sysfunc(getoption(source));
%let _TEMPFILE_ = _%sysfunc(datetime(),hex7.);
options NOnotes NOsource;
filename &_TEMPFILE_. TEMP lrecl = 512;
proc printto log = &_TEMPFILE_.;
run;
%put _user_;
proc printto log = log;
run;
data _null_;
length vname $ 2048;
retain vname " ";
infile &_TEMPFILE_. lrecl = 512 end=EOF;
input;
if "GLOBAL" =: _infile_ then vname=catx(" ", vname, scan(_INFILE_,2," "));
if EOF then call execute('%nrstr(%symdel ' || strip(vname) || " / nowarn;)");
run;
filename &_TEMPFILE_.;
options &_OPTIONS_.;
%mend symdelALL;
%put _user_;
%symdelALL()
%put _user_;
Bart
Hello,
You can take a look at the sashelp.vmacro view and adapt the following program to your needs.
%let x=1;
%let y=hello;
data _NULL_;
set sashelp.vmacro(where=(scope='GLOBAL'));
call execute(catx(' ','%nrstr(%symdel)',name,';'));
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.