Date: Sun, 11 Aug 1996 23:43:40 -0700
Reply-To: Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM>
Organization: Cary Consulting Services
Subject: Re: stored program facility and macros
I have some good news and some bad news.
Compiling the datasteps may save you a little time (20% maybe).
Compiling a macro probably almost none (10% maybe). Procedures are
already compiled and will not be sped up by any process (other then
increasing processor or disk access speed).
The time savings in the datastep compilation are almost all in the time
it takes to compile the data code. Little savings are realized in
execution of the compiled code (it is only executed after it is
compiled in any case.) Since the algorithm you are using is compiling
each datastep 100 times the savings there could be helpful.
Since you are only executing a macro once, (although you are looping 100
times) compiling the macro will probably do little to help the overall
performance of the simulation. The most gain I have seen from compiling
macros was when the macro was a complex beast with lots of branches of
conditional execution used many times. I regard macro compilation as
more of a code locking process then a performance improving one.
What would speed the process up would be to (if possible) try and do all
the datastep processing in one pass using a by-group variable to specify
the different iterations. This will of course only work if iterations
are not dependent on calculations of preceding iterations...
For example (meta-code)
%Macro XXX (iter=100);
%DO I=1 %TO &iter;
could be turned into
DO Iter=1 to 100;
Substantial savings might be realized...
David Gagnon wrote:
> I am running SAS simulations that essentially repeat the same operation
> several hundred times. I was wondering if the stored program facility
> could save me some time.
> The program essentially has an outer %DO loop that goes from 1 to 100 and
> then has a series of data steps and macro calls that goes something like
> %DO 1 %to 100;
> 2 data steps
> proc means
> macro call with proc lifetest and several datasteps
> data step
> macro call with several data steps, IML and proc lifetest [EM algorithm]
> data steps
> final data steps
> Will compiling some of the data steps help? Can entire macros be
> compiled? Can compiled code include procedures [PROCS] ? I'd like to cut
> down some of the running time on this program. Any help will be
> David R. Gagnon, MD MPH (617) 638-4457 [voice]
> Boston University School of Public Health (617) 638-4458 [fax]
> "ecrasez l'infamie"
Andrew J. L. Cary | I Reckon that the Opinions
Senior Curmudgeon | expressed here DO represent
Cary Consulting Services, Newark, CA | those of the management of
email@example.com | Cary Consulting Services