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 (May 1998, 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 May 1998 18:00:52 GMT
Reply-To:     Adam Hendricks <adam@BCSFSE.CA.BOEING.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Adam Hendricks <adam@BCSFSE.CA.BOEING.COM>
Organization: SRP II Team
Subject:      Re: %str() vs. %nrstr()
Content-Type: text/plain; charset=us-ascii

Public_Access_Machine wrote: > > Does anyone know whether using %nrstr(), when you are sure that there is > no macro resolving to be done inside the brackets, is more efficient > than using %str()? > > I often see %str() in code when it is clear that there is no macro > resolution needed and it seems to me that you can avoid having the macro > processor scan the function argument if you use %nrstr(). > > Does this sound right or is there some complication that I'm missing? > > Thanks, > Stewart Ravenhall > mailto: s.g.ravenhall@clara.net > -- > The opinions expressed in this communication are my own, > and do not necessarily reflect those of my employer.

Stewart,

%nrstr and %str will resolve %' %" %( %) to ' " ( ). But %nrstr will

not resolve macros or macrovariables whereas %str will. 100,000 loops

through the %nrstr call below took 14 seconds of CPU time compared to 45

seconds for 100,000 loops through the %str call on our HP 460 w/

HP-UX 10.02. The difference occurs because %str resolves %test1 and

&test2 defined in the code below. Running the same test on both %str

and %nrstr without resolving %test1 and &test2 (i.e. resolving

%' %" %( %) only) yielded similar CPU times around 11.5 seconds. So it

is safe to conclude that both are equivilantly efficient within thier

intersection of equal functionality (i.e. resolving %' %" %( %) only).

Code:

%macro test1; Two words %mend;

%let test2 = Here;

%put nrstr: %nrstr(%test1 , = ; %' %" %( %) &test2); %put str: %str(%test1 , = ; %' %" %( %) &test2);

Prints to Log:

str: Two words , = ; ' " ( ) Here

nrstr: %test1 , = ; ' " ( ) &test2

-- ________________________________________________ ______| |______ \ | Adam Hendricks TAD Staffing (assigned to SRP) | / \ | 425-234-6108 adam@bcsfse.ca.boeing.com | / \ | http://www.aa.net/ahendrix | / / | | \ / |________________________________________________| \ /________) (________\


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