LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2001, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 2 Jan 2001 18:08:43 +0100
Reply-To:   Peter Crawford <peter.crawford@DB.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Peter Crawford <peter.crawford@DB.COM>
Subject:   Re: Deleting macro variables from memory
Content-type:   text/plain; charset=iso-8859-1

If your macro variables are not, and cannot be, %local, as recommended by "maven fehd" below, then you could use this routine to reduce the memory they use. (May I suggest for "safe" programming, that only the "owner" or "creator" of a variable should be allowed to delete it. for example ... create and delete at the same code level.. .. unless well justified and explained ) The idea behind this routine, is to take the sas system meta data dictionary table of macro variable names, subset suitably and generate code like %let &mvarname =; for each macro varname

proc sql noprint; select trim(name) into :MVARS separated by '=; %let ' from dictionary.macros where scope ne 'AUTOMATIC' and /* whatever criteria is applicable for your set of macro vars, and*/ name ne 'MVARS' ; %put INFO: found &sqlobs macro vars ; quit; option symbolgen; %let &mvars =; Using up to 16 chars per macro var, this method should be good enough for circa. 2000 varco vars and more if average name length is less than 8

Just be careful not to empty macro vars you might still need !

Good luck

Datum: 02/01/2001 16:00 An: SAS-L@listserv.uga.edu

Antwort an: rjf2@cdc.gov

Betreff: Re: Deleting macro variables from memory, when a program is runni ng. Nachrichtentext:

> From: Aldi Kraja [mailto: aldi@wubios.wustl.edu]

> If I create a large group of macro variables such as: > %do i=1 %to &nrOfMacV; > ma&i=&i; > %end; > > where &nrOfMacV=400. > > How can I delete these macro variables from the temporary > memory, after > I am done with them, and in mean time the program will continue with > other steps.

if you are using a %do loop within a macro and you know the limit which you name NrOfMacV; then you should declare your set of macro variable %local before the assignment statements:

> %do i=1 %to &nrOfMacV; > %local ma&i; > %let ma&i=&i; > %end;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov OpSys: WinNT Ver: 8.1 ---> cheerful provider of UNTESTED SAS code!*! <--- e-mail your SAS improvements to: suggest@sas.com archives: http://www.listserv.uga.edu/archives/sas-l.html By using your intelligence you can sometimes make your problems twice as complicated. -- Ashleigh Brilliant

--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


Back to: Top of message | Previous page | Main SAS-L page