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 2002, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 8 May 2002 06:00:00 GMT
Reply-To:     gsnell@datasavantconsulting.com
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gregg Snell <gsnell@DATASAVANTCONSULTING.COM>
Subject:      Re: Failure in Month and Year Functions (invalid argument)
Comments: cc: Gigi Lipori <pflugg@BELLSOUTH.NET>

Gigi,

The date functions of MONTH and YEAR will only work with a date value, not a date-time value. Try this:

THISMNTH=MONTH(DATEPART(ADM_DATE)); THISYEAR=YEAR(DATEPART(ADM_DATE));

Regards,

Gregg P. Snell

>I'm running PC SAS v8.02. Have two statements that says: > >THISMNTH=MONTH(ADM_DATE); >THISYEAR=YEAR(ADM_DATE); > >I get an errors every time they execute -- Invalid argument to function >MONTH and Invalid argument to function YEAR. > >From the log I can see two example values that fail: >ADM_DATE = 26FEB2002:22:13:20 >ADM_DATE = 29MAR2002:06:24:00 > >Can anyone see why it's failing. Feel as though I'm missing something >obvious, but I just can't figure it out. Any help would be >appreciated...Gigi > > http://www.datasavantconsulting.com


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