i have date value like 15may2012 i want convert this date to 15may2012:00:00:00 how it will come?

Reply
New Contributor
Posts: 2

i have date value like 15may2012 i want convert this date to 15may2012:00:00:00 how it will come?

i have date value like 15may2012 i want convert this date to 15may2012:00:00:00 how it will come?

Super Contributor
Posts: 349

Re: i have date value like 15may2012 i want convert this date to 15may2012:00:00:00 how it will come?

Hi,

Try this..

data one;

yy=dhms('31MAy2012'd,00,00,00);

format yy datetime.;

run;

Thanks,

Shiva

New Contributor
Posts: 2

Re: i have date value like 15may2012 i want convert this date to 15may2012:00:00:00 how it will come?

Thank u for u r answer

But you used 15may2012'00'00'00 .but my doubt is only use 15may2012 in input value(informat).and get the value like 15may2012:00:00:00 as format

please be help..

Super Contributor
Posts: 349

Re: i have date value like 15may2012 i want convert this date to 15may2012:00:00:00 how it will come?

Hi Rahul,

you can also try this...but I will use DHMS function like above to get the datetime format.

data one;

xx='31MAy2012'd;

yy=xx*86400;

format yy datetime.;

run;

If you directly apply format on xx as datetime. then you will different values like 01JAN60:05:19:04

Thanks,

Shiva

Super User
Super User
Posts: 7,046

Re: i have date value like 15may2012 i want convert this date to 15may2012:00:00:00 how it will come?

If you are reading the value from a text file then use the ANYDTDTM informat.

data _null_;

  input @1 date date9. @1 dt anydtdtm. ;

  format date date9. dt datetime.;

  put (_all_) (=);

cards;

15MAY2012

run;

date=15MAY2012 dt=15MAY12:00:00:00

Frequent Contributor
Posts: 95

Re: i have date value like 15may2012 i want convert this date to 15may2012:00:00:00 how it will come?

İf you already have a date value, 15May2012, stored in a data set but you want to display datetime,15May2012:00:00:00, without changing the value of underlyıng variable you may try picture directives in proc format.

Zafer

proc format;

  pıcture dtfmt low-high = '%d%b%Y:00:00:00' (datatype=date);

run;

data _null_;

  x = '15May2012'd;

  put x dtfmt18.;

run;

15MAY2012:00:00:00

Ask a Question
Discussion stats
  • 5 replies
  • 336 views
  • 0 likes
  • 4 in conversation