Hi All,
I am looking for 20191125111133 this date and time format.
I am able to get the date by yymmddn8.. format but not able get the time.
please can you suggest.
%let today=%sysfunc(today(),yymmddn8.);
%put &today.;
data a;
c= time();
format c time.;
d=substr(c,2,2);
run;
and I want combine yymmddn8. and time.
Thanks.,
SS
Try this
%let now=%sysfunc(datetime());
%let dt=%sysfunc(putn(&now,B8601DN8))%sysfunc(timepart(&now),B8601TM6);
%put &dt.;
Result:
20191125130035
Try this
%let now=%sysfunc(datetime());
%let dt=%sysfunc(putn(&now,B8601DN8))%sysfunc(timepart(&now),B8601TM6);
%put &dt.;
Result:
20191125130035
You could try something like the following and then check the log for the results:
data _null_;
current_day = put(today(),yymmddn8.);
current_time = put(time(),time.);
current_day_time = cats(current_day, compress(current_time,':'));
put _all_;
run;
Kind regards,
Amir.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.