|
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
>
|