| Date: | Wed, 9 May 2001 17:26:52 +1000 |
| Reply-To: | Thomas Rick <rthomas@WOOLWORTHS.COM.AU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Thomas Rick <rthomas@WOOLWORTHS.COM.AU> |
| Subject: | Re: Help with DateTime22.3 format |
| Content-Type: | text/plain |
|---|
David,
You can use the DATEPART function to extract the date from datetime
variable. For example you can use
if datepart(srvy_DT) > '04apr01'd;
to select all records with a date greater than April 4.
Alternatively, you can use the following to select your records based on a
datetime variable
if srvy_DT > '04APR2001:09:30:20.177'dt ;
Hope this helps.
Regards,
Rick.
> -----Original Message-----
> From: David L. Alderton Ph.D. [SMTP:David.Alderton@ATT.NET]
> Sent: Wednesday, May 09, 2001 1:20 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Help with DateTime22.3 format
>
> I'm pulling data off a SQL Server 7 database. One of the variables is the
> date a survey was filled out. It comes across as a SAS numeric variable
> with a datetime22.3 format. For example '07FEB2001:09:30:20.177' is one
> value with a crazy numeric translation of 1297157420.177 which I guess is
> the number of minutes since some date. Anyway, what I am trying to do is
> subset the data as I bring it across from the server based on the last
> time
> I pulled the data. Say I pulled the data from the beginning of the survey
> until 4 April 01. This time I want to get just the surveys that have been
> filled out since 4 April 01 (to today). I cannot for the life of me
> figure
> out how to translate the datetime22.3 into just a traditional date (e.g.,
> '04APR01'd) nor can I figure out how to create a variable on the same
> metric
> as the datetime22.3 value to use for comparison.
>
> Ideally, I simply want to create a constant for use in a subsetting "if"
> statement...
> if Srvy_DT > XXX;
> Where XXX would be directly comparable number to Srvy_DT (datetime22.3
> format). Or, I want to translate the Srvy_DT into a standard date
> '04APR01'd and then compare it to another standard date.
>
> Can anyone help? I have never used dates in this format and I am stumped.
>
> Thanks, David.
> David L. Alderton, Ph.D.
> Institute for Selection and Classification
> Navy Personnel Research, Studies, and Technology
> Navy Personnel Command
**********************************************************************
CAUTION: This message may contain confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message, any use or disclosure of this message is prohibited. If you received this message in error please notify Mail Administrators immediately. You must obtain all necessary intellectual property clearances before doing anything other than displaying this message on your monitor. There is no intellectual property licence. Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Woolworths Ltd.
**********************************************************************
|