%macro putmvar(scope=global); %*---Uses proc sql with the sashelp.vmacro virtual dataset to display a report of macro variables of a specified scope (global is default) ordered by name. (The SAS %put _all_ and %put _glboal_ stmts display them in a quasi-random order). From a tip published somewhere on the SAS support site and seen (by jgb) July, 2008.---; %let scope=%upcase(&scope); proc sql; select name, value %if &scope=ALL %then %str(,scope); from sashelp.vmacro %if &scope ne %str(ALL) %then %str(where scope="&scope") ; order by scope, name, offset; quit; %mend putmvar;