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:   Thu, 7 Aug 1997 08:28:52 -0700
Reply-To:   Don Stanley <don_stanley@IBM.NET>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Don Stanley <don_stanley@IBM.NET>
Organization:   SYSWARE Consulting
Subject:   Re: Macro problem (caused by memory leak?)
Content-Type:   text/plain; charset=us-ascii

hi victor

i reported a similar problem to sas a while back. whilst our local office accepted and agred a problem existed, cary could not reproduce and basically left us with no useful response. you have narrowed it down much further than we could so you may get a better response. this was onsolaris 2.5 running 6.12.

We did however as of 6.12 replace all our macro function calls with use of %sysfunc. this allows you to use data step functions in macro and seems much quicker. it is also gives a bit easier to read code with less knowledge of macro required.

eg

%let upper = %sysfunc(upcase(&string)) %let sub = %sysfunc(&string,5,3))

Don

Victor Bos wrote: > > 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; > > %q; > > 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.

-- =========================================================================== Don Stanley Don_Stanley@IBM.NET Ph 0064 021 479 863 Fax 0064 04 386 2038 (Computer fax not always operating)

Director (1 of 4) of SYSWARE Consulting Group, NZ SAS Specialists.

Snail Mail Box 14554 Kilbirnie Wellington NEW ZEALAND

Thought for the life ... nah, thinking takes to much effort

Ashleys dad and proud of it!! Especially when he sleeps. ===========================================================================


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