Date: Tue, 4 Mar 2008 12:35:33 -0500
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: Bug in %DO %WHILE while processing a 10-digit numeric value?
In-Reply-To: <BAY123-W14B312FB80C8E47A6C5798DE100@phx.gbl>
Content-Type: text/plain; charset=ISO-8859-1
On Tue, Mar 4, 2008 at 10:59 AM, toby dunn <tobydunn@hotmail.com> wrote:
> I dont like teh solution as using %SysEvalF Now means there will
> not only be one call to %SysEvalF but also an implicit call to %Eval which
> is redundant. It also fixes the macro quoting problem with %Eval at a cost.
A little testing reveals that the cost of an implied EVAL of a Boolean
SYSEVALF appears to be very small.
NOTE: Number of Words: 3209
Using Implied EVAL only: T1=17.7960000038147
NOTE: Number of Words: 3209
Using SYSEVALF plus Implied EVAL: T2=18.1879999637603
Difference: T1-T2 = -0.3919999599456
using....
%let list=%sysfunc(repeat(%str(this is a word list NE < > ,),400));
%macro test;
%local n word b e t1 t2;
%let B=%sysfunc(datetime());
%let n = 1;
%let word = %scan(%bquote(&list),&n,%str( ));
%do %while(%bquote(&word) ne);
%let n = %eval(&n+1);
%let word = %scan(%bquote(&list),&n,%str( ));
%end;
%put NOTE: Number of Words: %eval(&n-1);
%let E=%sysfunc(datetime());
%let t1=%sysevalF(&e-&b);
%put NOTE- Using Implied EVAL only: T1=&t1;
%let B=%sysfunc(datetime());
%let n=1;
%let word=%scan(%bquote(&list),&n,%str( ));
%do %while(%sysevalF(%bquote(&word) ne,BOOLEAN));
%let n = %eval(&n+1);
%let word = %scan(%bquote(&list),&n,%str( ));
%end;
%put NOTE: Number of Words: %eval(&n-1);
%let E=%sysfunc(datetime());
%let t2=%sysevalF(&e-&b);
%put NOTE- Using SYSEVALF plus Implied EVAL: T2=&t2;
%PUT NOTE- Difference: T1-T2 = %sysevalf(&t1-&t2);
%mend test;
%test;
|