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 (June 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 25 Jun 2004 13:25:08 -0400
Reply-To:     sashole@bellsouth.net
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Paul M. Dorfman" <sashole@BELLSOUTH.NET>
Organization: Sashole of Florida
Subject:      Re: %SYSFUNC and PUT function
Comments: To: "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM>
In-Reply-To:  <81BFA8F7807F1349AD6C16AD00A1AB9B017324FD@AMSM1BMSGM01.ent.core.medtronic.com>
Content-Type: text/plain; charset="us-ascii"

Jim,

Right, not to mention INT, which will leave an always integer date value utterly intact...

Kind regards, ---------------- Paul M. Dorfman Jacksonville, FL ----------------

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > Behalf Of Groeneveld, Jim > Sent: Friday, June 25, 2004 10:58 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: %SYSFUNC and PUT function > > Hi friends, > > Instead of ABS you could use MIN, MAX, MEAN, maybe SUM, maybe > RESOLVE, and possibly some more functions. > > Regards - Jim. > -- > . . . . . . . . . . . . . . . . > > Jim Groeneveld, MSc. > Biostatistician > Science Team > Vitatron B.V. > Meander 1051 > 6825 MJ Arnhem > Tel: +31/0 26 376 7365 > Fax: +31/0 26 376 7305 > Jim.Groeneveld@Vitatron.com > www.vitatron.com > > Showing statistically significant differences between > football teams, generally all sporters, requires larger > samples than usually applied. > > [common disclaimer] > > > -----Original Message----- > From: Howard Schreier [mailto:Howard_Schreier@ITA.DOC.GOV] > Sent: Friday, June 25, 2004 16:46 > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: %SYSFUNC and PUT function > > > If you know that all of your values are non-negative, then > the ABS function has no effect. But try this variation on > Gordon's code: > > %let mydate=25jun1959; > %let prt_d=%sysfunc(abs("&mydate"d), mmddyy10.); > %put &prt_d; > > The result is > > 07/09/1960 > > because SAS dates are negative for 31 December 1959 and earlier. > > I have often used techniques which are tricky and/or > dependent on data properties which I know to hold. But if > there's an equally good alternative which is more > straightforward and bulletproof, I usually opt to use it. So > here I'd use PUTN. > > When using PUTN *in a DATA step* with a constant as the > second argument (the format), you *would* quote it. The > %SYSFUNC context is different. > > On Fri, 25 Jun 2004 09:45:40 -0400, Talbot Michael Katz > <topkatz@MSN.COM> > wrote: > > >Hi, Gordon. > > > >I tried your trick, > >>%let v=%sysfunc(abs(&i), z4.); > >and it works fine. Elegant. Thank you. > > > >Using PUTN as others suggested also appears to work: > >%let v = %sysfunc(putn(&i.,Z4.)); > >The syntax is exactly the same as what I wanted to do with > PUT, but it > >took me awhile to figure that out from the PUTN > documentation -- I kept > >wanting to put the format string in quotes. > > > >-- TMK -- > > On Thu, 24 Jun 2004 18:07:51 -0400, Buchanan, Gordon > <gordon.buchanan@GMACRFC.COM> wrote: > > >You can also use the fact the the %sysfunc function lets you > specify a > >format as the second parameter. This works fine: > > > >%let v=%sysfunc(abs(&i), z4.); > > > >Just use some function that does not change the value of > your number; > >in this case I use ABS. > > > >I often use this to reformat date macro variables as in: > > > >%let d=25jun2004; > >%let prt_d=%sysfunc(abs("&date"d), mmddyy10.); > > [snip] >


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