Help using Base SAS procedures

time format

Accepted Solution Solved
Reply
Super Contributor
Super Contributor
Posts: 440
Accepted Solution

time format

morning guys,

time needs to be in this format hhmmss with length 6

is there a format that would bring my current time 8:42:00 to  a 084200?

Please advise


Accepted Solutions
Solution
‎09-19-2014 09:06 AM
Respected Advisor
Posts: 3,780

Re: time format

proc format;
  
picture todx other='%0H%0M%0S' (datatype=time);
   run;
data _null_;
  
x = time();
   put x=tod. x=todx.;
  
run;

x=06:03:13 x=060313

Looking at the documentation I see that seconds with no decimal should be upper case S not lower case s which is for decimal seconds.  It may not make any difference but I would change to S.

Message was edited by: data _null_

View solution in original post


All Replies
Solution
‎09-19-2014 09:06 AM
Respected Advisor
Posts: 3,780

Re: time format

proc format;
  
picture todx other='%0H%0M%0S' (datatype=time);
   run;
data _null_;
  
x = time();
   put x=tod. x=todx.;
  
run;

x=06:03:13 x=060313

Looking at the documentation I see that seconds with no decimal should be upper case S not lower case s which is for decimal seconds.  It may not make any difference but I would change to S.

Message was edited by: data _null_

Super Contributor
Super Contributor
Posts: 440

Re: time format

thanks data_null!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 205 views
  • 1 like
  • 2 in conversation