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 (February 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 5 Feb 2004 11:31:35 -0500
Reply-To:     "Chakravarthy, Venky" <Venky.Chakravarthy@PFIZER.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Chakravarthy, Venky" <Venky.Chakravarthy@PFIZER.COM>
Subject:      Re: convert date to sas date
Comments: To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Content-Type: text/plain; charset="iso-8859-1"

Thanks Howard. Those are good points.

Multiple blanks can be pre-processed with the COMPBL function in the input function (assuming there is an input sas data set). The range of dates can be easily extended to span a few centuries. The leading zeroes issue is more difficult to treat. The poster may have to provide more information (a truly representative sample) to judge whether these are valid concerns.

_________________________________ Venky Chakravarthy E-mail: swovcc_AT_hotmail_DOT_com

-----Original Message----- From: Howard Schreier [mailto:Howard_Schreier@ITA.DOC.GOV] Sent: Thursday, February 05, 2004 10:44 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: convert date to sas date

Two caviats.

1. Obviously, this only works for the range of dates loaded when the informat is built.

2. Less obviously, this informat is not as flexible as the built-in informats regarding things like leading zeroes or multiple blanks. Try testing against values like:

02 January 2005 11 March 2005

On Thu, 5 Feb 2004 08:55:40 -0500, Chakravarthy, Venky <Venky.Chakravarthy@PFIZER.COM> wrote:

>In version 9, perhaps the ANYDT informat will let you read it in straight. >For versions up to 8.2 as Harry has pointed out there is no worddatx >informat. You can create your own informat though using the worddatx format: > >data control ; > retain fmtname "spaced" type "I" ; > do label = "01jan1950"d to "31dec2049"d ; > start = put(label,worddatx.-l) ; > output ; > end ; >run ; > >proc format cntlin = control ; >run ; > >data _null_ ; > input spacedat & : spaced17. ; > put spacedat= date9. ; > cards ; >1 January 1990 >29 February 2004 >31 December 1975 >30 September 2002 >run ; > >Kind Regards, >_________________________________ >Venky Chakravarthy >E-mail: swovcc_AT_hotmail_DOT_com > >-----Original Message----- >From: Doug [mailto:queanbeyan@HOTMAIL.COM] >Sent: Wednesday, February 04, 2004 10:03 PM >To: SAS-L@LISTSERV.UGA.EDU >Subject: convert date to sas date > > >Hi, > >I have a dataset that has a character variable called 'Created' that >has a date in the following format = 5 February 2004. > >Could someone please tell me how I can change this to a sas date? I >have scanned and concatenated, but there must be an easier way - like >an informat? > >Doug > > >LEGAL NOTICE >Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.

LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.


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