BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sathya66
Barite | Level 11

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

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Try this

 

%let now=%sysfunc(datetime());
%let dt=%sysfunc(putn(&now,B8601DN8))%sysfunc(timepart(&now),B8601TM6);
%put &dt.;

Result:

 

 

20191125130035  

 

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Try this

 

%let now=%sysfunc(datetime());
%let dt=%sysfunc(putn(&now,B8601DN8))%sysfunc(timepart(&now),B8601TM6);
%put &dt.;

Result:

 

 

20191125130035  

 

Amir
PROC Star

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.

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 4113 views
  • 0 likes
  • 3 in conversation