macro view테이블을 사용하여서 symdel함수로 삭제하는 방법이 있어서 올립니다.
[참고]
%put 으로 매크로 변수 확인;
_ALL_, _AUTOMATIC_, _GLOBAL_, _LOCAL_, _USER_
예] %put _user_; * 사용자 정의 매크로 변수 확인;
http://support.sas.com/kb/26/154.html
Sample 26154: Delete all user-defined macro variables from the global symbol table
/* Please refer to the DETAILS tab for syntax information regarding %SYMDEL. */
%let x=1;
%let y=2;
%let z=3;
/* Write macro variable values to the log to show they do have values. */
%put &x &y &z;
/* VMACRO is a SASHELP view that contains information about currently */
/* defined macros. Create a data set from SASHELP.VMACRO to avoid a */
/* macro symbol table lock. */
%macro delvars;
data vars;
set sashelp.vmacro;
run;
data _null_;
set vars;
temp=lag(name);
if scope='GLOBAL' and substr(name,1,3) ne 'SYS' and temp ne name then
call execute('%symdel '||trim(left(name))||';');
run;
%mend;
%delvars
/* Write macro variable values to the log to show they no longer have values. */
%put &x &y &z;
* PROC SQL처리;
proc sql noprint;
select distinct NAME
into :gmacs
separated by ' '
from dictionary.macros
where upcase(SCOPE) eq 'GLOBAL' and NAME NE 'GMACS';
quit;
%symdel &gmacs gmacs;
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.