Date: Mon, 14 Aug 2000 12:17:00 GMT
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Subject: Re: Can you clear Macrovariables from the PDV during program run?
Content-Type: text/plain; format=flowed
Strictly speaking, clearing macro variables from PDV is impossible, because
they do not reside there. Unfortunately, it is not possible to clear
*variables* from PDV, either, for instance, redimension an array - memory
allocation management in the DATA step is not provided. (Of course, a clever
one could clear everything in the DATA step at once by means of STOP or
ABORT, or everything including the macro memory using ENDSAS, but I am sure
this is not what we are talking about here :-).)
I do not know of any reliable method available to manage macro memory
allocation, either. However, I have not found any significant correlation
between the performance of the DATA step and Base procedures with the macro
memory 'polluted' with thousands of macro variables, and without such
pollution. Macro memory appears to be manages separately, which also makes a
lot of common sense. Of course, at the extreme, one might conceieve a
situation where an adverse interaction between the macro memory and the rest
of the stuff would occur at the hardware level, for instance, if macro
memory utilization is so large that it affects total memory consumption with
swapping to the virtual memory and performance degradation as a result.
On the other hand, if by 'clearing macrovariables' you mean assigning null
values, then it is of course possible. For instance, you can acquire the
information about all available user macro variables from the dictionary
tables and then use CALL SYMPUT to fill them out with nulls. I can imagine
one situation where such action would reduce total memory usage, namely, if
existing macrovariables hold long string values. Say, consider the
22 %macro a;
23 %do i=1 %to 5000;
24 %global a&i;
25 %let a&i = %sysfunc(repeat(1,199));
29 data _null_; run;
NOTE: The DATA statement used 0.01 CPU seconds and 10531K.
30 data _null_;
31 do i=1 to 5000;
32 call symput ('a'||left(put(i,4.)),'');
NOTE: The DATA statement used 0.17 CPU seconds and 9860K.
35 data _null_; run;
NOTE: The DATA statement used 0.01 CPU seconds and 9735K.
The amount of the memory thus saved roughly corresponds to 5000*200 bytes
(minus whatever space the null variables may occupy), so the above
assumption may be plausible.
Paul M. Dorfman
>Subject: Can you clear Macrovariables from the PDV during program run?
>Date: Mon, 14 Aug 2000 07:18:46 GMT
>I was wondering whether is possible to clear macrovariables (i.e.
>remove them) from the PDV/memory?
>I have a program generating hundreds of macrovariables with
>corresponding values. It would be more efficient, I think, if I could
>tell the program to drop/remove the macrovariables that are no longer
>needed for the remainder of the program.
>Is this possible and how?
>ALZ Stainless Steel
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com