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 (June 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 23 Jun 2009 08:48:52 -0700
Reply-To:   "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Organization:   http://groups.google.com
Subject:   Re: Is there a limit on the max number of macro variables in a
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

On Jun 23, 10:39 am, chang_y_ch...@HOTMAIL.COM (Chang Chung) wrote: > On Mon, 22 Jun 2009 21:19:13 -0400, Tom Smith <tomqui...@GMAIL.COM> wrote: > > ... > > >Is there any limit on the maximum number of macro variables allowed to be > >created in a macro? > > Hi, > > On the issue of how many macro variables can be created in a session, I > don't think there is any limit specified at all. I could not find any > section on this in the manual. (so far, that is. Please let me know if you > find any.) > > Memory should not be an issue, either. Because even a million macro > variables can easily fit into multiple GB's of memory that come with even > with a typical PC. > > Performance, however, is an issue. It seems that macro system is optimized > toward the cases where there are only small number of macro vars > used/created. I managed to create 900K macro variables using the code below. > But on my pc with 9.2, it took over an hour of wall-time. It shows that as > the number of macro variables increases, it takes longer to create > additional macro variables. HTH. > > Cheers, > Chang

I took Chang's code and added data collection for plotting. The macro symbol table exhibits classic quadratic behavior.

%let longest_i_will_wait = '00:00:20't;

data mvar_benchmark; t0 = time(); format t0 elapsed time.; put "start at: " t0; do i = 1 to 9e5 until (elapsed > &longest_i_will_wait); t = time(); length mvar $32; mvar = cats('m',i); call symput(mvar,mvar); output; elapsed = time()-t0; end;

put 'elapsed:' elapsed;

keep i t; run;

ods listing;

symbol1 i=rq;

proc gplot data=mvar_benchmark; plot i * t; run;

symbol1 i=join;

proc gplot data=mvar_benchmark; plot i * t; run;

-- Richard A. DeVenezia http://www.devenezia.com


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