Date: Wed, 11 Oct 2006 10:49:06 +0100
Reply-To: Guido T <cymraegerict@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Guido T <cymraegerict@GMAIL.COM>
Subject: Re: clearing macro variables from memory
In-Reply-To: <1160553717.453547.218520@b28g2000cwb.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi Rune ,
I don't know a way in macro to easily clear out the global macro
variable, but the following kludgey code will do it (mostly) ...
%put _global_;
data __test(keep=name);
set sashelp.vmacro;
where scope eq 'GLOBAL';
run;
data _null_;
set __test;
put name=;
call symdel(name);
run;
%put _all_;
The 2 step appears to be needed to avoid problems SASHELP.VMACRO view
is updated after a macro variable has been deleted. Also SAS (at
least in 8.2) is a little confused about the status of SYSDBMSG and
SYSDBRC. They are listed as global, but when you attempt to delete
them an error message "ERROR: Attempt to delete automatic macro
variable" is displayed.
Perhaps the where clause should be
where scope eq 'GLOBAL' and name not like 'SYS%';
HTH
++ Guido
On 11/10/06, Rune Runnestø <rune@fastlane.no> wrote:
> Hi,
> I am testing macros and it would have been convenient if it is possible
> to clear the values of macro variables from the memory of SAS without
> having to shutdown SAS and restart it. It's just the macro variables
> I have made myself, not the system macro variables (doubt if SAS would
> let anyone manipulate them).
>
> Regards, Rune
>