Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert numeric data to hour:minute

Status
Not open for further replies.

proximo20

Technical User
Sep 29, 2009
22
US
Hi,

My data looks like this

time code
1300 ert
1412 brt
1435 grt

and I need it like this

13:00 ert
14:12 brt

or

1:00 ert
2:12 ...

Thanks
 
I'm not a time expert, but here is my best effort.

Code:
/*sample dataset*/
data unformatted;
input time code $3.;
datalines;
1300 ert
1412 brt
1435 grt
;
run;

data formatted;
set unformatted;
newtime = put(time,$4.);
format realtime hhmm5.;
realtime = hms(substr(newtime,1,2),substr(newtime,3,2),00);
run;

DBLAN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top