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 (January 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Jan 2007 12:32:01 -0500
Reply-To:     "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Subject:      Re: tip: Whitlock do-loop (DOW) and call execute
Comments: To: sas-l@uga.edu

"Fehd, Ronald J. (CDC/CCHIS/NCPHI)" wrote: > I am always on the alert to avoid having to do extra work > to make-unique using either > * freq > * sort > * sql > to produce a list-processing -- aka dynamic programming -- > data set to be used to generate reports. > > violet! DOW to the rescue: > > %macro report(region=); > %Put reg<&Reg.>; > %mend; > > DATA _Null_; > do until(EndoFile); > do until(Last.Region); > set sashelp.Shoes > end = EndoFile; > by Region; > end; > call execute('%report(region=' !! trim(Region) !! ')' ); > end; > stop; > run; > run; >

It many cases it is best to delay the actual execution of the 'desired to be executed' macro until after the data step completes. Such is done by wrapping the macro invocation in a %nrstr

dispatch = cats ('%report(region=',region,')'); delayed_dispatch = cats ('%nrstr(',dispatch,')'); call execute (delayed_dispatch);

I don't see where the DOW contributes to the dispatching process. A simpler form would suffice.

set sashelp.shoes; if last.region; ... dispatch ... run;

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


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