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 (March 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 17 Mar 2008 15:16:27 -0500
Reply-To:   "data _null_," <datanull@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "data _null_," <datanull@GMAIL.COM>
Subject:   Re: How to Fill in Missing dates ??
Comments:   To: SAS_learner <proccontents@gmail.com>
In-Reply-To:   <c2192a610803171251j6d07a940g8420bd49e0febcfe@mail.gmail.com>
Content-Type:   text/plain; charset=ISO-8859-1

This is a method that may work for your data.

data _null_; *yyyy-mm-ddTHH:MM:SS.; cmdtc0 = '....-01-01T00:00:00'; format datetime datetime.; input cmdtc :$20.; substr(cmdtc0,1,length(cmdtc))=cmdtc; dateTime = input(cmdtc0,ymddttm20.); put (_all_)(=); cards; 1999 1999-02 1999-04-04 1999-06-05T11 1999-06-05T12:30 1999-06-05T12:30:14 ;;;; run;

cmdtc0=1999-01-01T00:00:00 datetime=01JAN99:00:00:00 cmdtc=1999 cmdtc0=1999-02-01T00:00:00 datetime=01FEB99:00:00:00 cmdtc=1999-02 cmdtc0=1999-04-04T00:00:00 datetime=04APR99:00:00:00 cmdtc=1999-04-04 cmdtc0=1999-06-05T11:00:00 datetime=05JUN99:11:00:00 cmdtc=1999-06-05T11 cmdtc0=1999-06-05T12:30:00 datetime=05JUN99:12:30:00 cmdtc=1999-06-05T12:30

On Mon, Mar 17, 2008 at 2:51 PM, SAS_learner <proccontents@gmail.com> wrote: > Hello _all_ , > > In a CM dataset I have a variable cmstdtc in Format yyyy-mm-ddTHH:MM:SS. > There are dates that have missing Month and day and time part, so I need to > fill 01 for month and 01 for day and T00:00 for time part, > > I am using Length statement Length(CMSTDTC) = 4 Etc. to do this but is > there better way then do thing some thing like this . > > thanks all for your help and time > > thanks > Kumar >


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