From: Scott Bass on
Hi,

SAS 9.1.3 SP 4, Windows XP

Is there a format to print time values (HH:MM, no seconds needed) in
24 hour format, i.e. with a leading zero?

A check of the doc indicates "no", but just wanted to confirm. I just
want standard 24 hour time output, like 04:53 and 18:12. 24 hour time
output always uses a leading zero for hour < 10. I'm surprised SAS
doesn't have a format to do this.

This is the best I could come up with - better approaches most
welcome.

data _null_;
time="09:59:59"t; * "play" with this value, both < and > 10:00 ;
timec=ifc(hour(time) <
10,cats("0",put(time,time5.)),put(time,time5.));
put time =time5. timec=;
run;

Thanks,
Scott
From: Patrick on
Hi Scott

Hope you're well.

Seems you forgot about picture formats.

Cheers
Patrick

proc format;
picture _zhhmm
other='%0H:%0M'
(datatype=time);
run;

data _null_;
time='5:12't;
put time= _zhhmm.;
run;