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 (August 1997, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Aug 1997 07:57:55 GMT
Reply-To:     Victor Bos <Victor.Bos@NL.ORIGIN-IT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Victor Bos <Victor.Bos@NL.ORIGIN-IT.COM>
Organization: Origin
Subject:      Macro problem (caused by memory leak?)

Hello everybody,

During the development of a quite complex macro I noticed that the running time of that macro increased each time I submitted it. When I tried to find out how this is caused, I noticed that the resolving of macrovariables takes more and more time at each invocation. The following simple program shows the problem:

%macro q; data _null_; call symput ('t', time ()); run;

%do i = 1 %to 100; %let j = %lowcase (&i); %end;

data _null_; t = time () - &t; put t=; run; %mend;


If you run the %q macro, say 50 times, you'll see time t increase. I tried it on an RS/6000 machine running AIX (SAS 6.12), a DEC Alpha running VMS (SAS 6.09), and Windows95 (SAS 6.12). The problem seems to exist at all those operating systems, although the problem seems to be less big on Windows95, as the time seems not only to increase, but also decrease in subsequent invocations.

My question is: has anyone of you encountered this problem? Perhaps on other operating systems?

Victor Bos, Origin /Business Management Solutions.

PS: Another thing I noticed is that if you replace the %lowcase in the program above by %upcase, the program runs much, much faster. This is explainable as %upcase is a macro function, and %lowcase is an autocall macro provided by SAS. So a good programming habit is to use %upcase instead of %lowcase in macros if possible.

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