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

/*-----
 * group: Macro programming
 * purpose: Set all global macro variables to blank
 * notes: SQL implementation emits a Proc step. For v8.2+ consider using <B><CODE STYLE="white-space:nowrap">%symdel <I>mvar</I></CODE></B>
 */

%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;

/**html
 * <p>Sample code</p>
 */

options nomprint nonotes nosource;

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

%symdel x;
%put x=&x;

options source notes mprint;
