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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.