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 (July 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 24 Jul 2006 12:00:54 -0400
Reply-To:     Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject:      Re: SCL Questions (hijacked thread)
Comments: To: toby dunn <tobydunn@hotmail.com>
In-Reply-To:  <BAY101-F1135A3B343818992A1BB4ADE650@phx.gbl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Doug

Let's assume Toby has read Kevin's mind correctly and Toby's example is in fact what Kevin had in mind. If I understand correctly, the example merely tests the denominator for a zero condition and performs the division only if the denominator is not zero. I think even those unfamiliar with SAS Component Language realize that the macro is pointless. It adds no functionality to a simple if statement:

IF DENOM^=0 THEN FOO=NUMER/DENOM ;

But for those literally minded folks who insist on seeing SCL code with the same functionality here is the equivalent pointless SCL code:

init: dcl num denom foo numer, char(80) divide;; divide='IF DENOM^=0 THEN FOO=NUMER/DENOM ;'; submit continue; data foo; set foo; &divide; run; endsubmit; return;

Even though pointless as regards functionality, it does serve the purpose of showing how much simpler even pointless code is than functionally equvalent Antiquated Macro Language.code.

Joe Pointless

On 7/24/06, toby dunn <tobydunn@hotmail.com> wrote: > Doug , > > I think this is what Kevin had in mind: > > %Macro Divide( Numer = , Denom = ) ; > > %If ( &Denom = 0 ) %Then %Do ; > 0 > %End ; > %Else %Do ; > %SysEvalF( &Numer / &Denom ) > %End ; > > %Mend Divide ; > > > > Data Foo ; > Set Foo ; > Foo = Resolve( '%pdiv( Numer = ' || var1 || ' , Denom = ' || var2 || ' ) ' ) > ; > Run ; > > > > > > Toby Dunn > > 'They say that Spanish is the Language of Love, > I Loved the way it rolled off of her tongue' > > 'I dont know what she said but I loved the way she said it' > > > > > > > From: Doug Rohde <drohde01@COMCAST.NET> > Reply-To: Doug Rohde <drohde01@COMCAST.NET> > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: SCL Questions (hijacked thread) > Date: Mon, 24 Jul 2006 10:24:31 -0400 > > I don't know if this is what Kevin had in mind, but this is the sort of > pseudo-function I use for protected division (or log, or sqrt, etc.): > > %macro pdiv(newvar,num,denom,default = 0); > if &denom = 0 then &newvar = &default; > else &newvar = &num / &denom; > %mend; > > Then of course I just call it like this: > > data foo; set foo; > %pdiv(foo,var1,var2); > run; > > I am interested to see how something like this is implemented in SCL. > Thanks. > > Doug R > > On Sat, 22 Jul 2006 11:47:40 -0400, Joe Whitehurst > <joewhitehurst@GMAIL.COM> wrote: > > >Kevin, > > > >I have just been trying to douse some of the enthusiasm with which > >some MMMMs have been trying to promote the use of the Antiquated Macro > >Language, and I believe I have had some small success! Some of the > >MMMMs at least now mention SCL sort of as an afterthought when > >suggesting alternative solutions to questions posted by obvious > >neophytes. I understand and often use the Antiquated Macro Language > >to generate SCL code. But, I have not seen a datastep pseudo function > >created by the Antiquated Macro Language that I could not create with > >SCL. Do you have an example handy? > > > >Joe > > > > > > > >> > >> I don't personally agree with Joe's "religious persecution" of macro in > >> favor of SCL. I even know of a few a things that macro can do which SCL > >> cannot do as well (for instance, you can use macros to effectively > create > >> custom data step functions and even generate SCL code >


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