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
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..
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
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
İ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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.