## convert sas time5. format values to nominal values

Frequent Contributor
Posts: 106

# convert sas time5. format values to nominal values

Hi ,

Is there an easy way to convert  time values in time5. format into nominal time values.?

Example: 8:30 as 8.5

16:30 as 16.5

17:45 as 17.75

Super User
Posts: 9,409

## Re: convert sas time5. format values to nominal values

One way:

```data want;
time="08:30"t;
number=hour(time)+ ((10 / (60/minute(time)))/10);
output;
time="17:45"t;
number=hour(time)+ ((10 / (60/minute(time)))/10);
output;
format time time5.;
run;```
Super User
Posts: 9,886

## Re: convert sas time5. format values to nominal values

Since time values are just counts of seconds, a simple division and rounding will do it:

``````data test;
input time time5.;
time_nom = round(time/3600,.01);
format
time time5.
time_nom 5.2
;
cards;
08:30
16:30
17:45
;
run;
``````
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Discussion stats
• 2 replies
• 91 views
• 2 likes
• 3 in conversation