Download clearmvs.sas clearmvs.sasSubmit a comment

/*
 * Richard A. DeVenezia
 * 6/16/1999
 * 4/17/2004 select into:
 *
 * Use %symdel mvar in version 8.2+
 */

%macro clearmvs;

  %local _clear_;

  proc sql noprint;
    select '%let '||compress(name)||' = ;'
    into :_clear_ separated by ' '
    from dictionary.macros
    where scope = 'GLOBAL'
      and name ne '_CLEAR_'
    ;
  quit;

  &_clear_.

%mend clearmvs;

Sample code

options nomprint nonotes nosource;

%let x=1;
%put x=&x;
%clearmvs
%put x=&x;

%symdel x;
%put x=&x;

options source notes mprint;