BookmarkSubscribeRSS Feed
ari
Quartz | Level 8 ari
Quartz | Level 8

Hi, Is there a SAS function to convert the SAS clock time to nominal values?

for example:

8:30 am    = 8.5

16:30 pm = 16.5

likewise...

2 REPLIES 2
ballardw
Super User

@ari wrote:

Hi, Is there a SAS function to convert the SAS clock time to nominal values?

for example:

8:30 am    = 8.5

16:30 pm = 16.5

likewise...


SAS time values are numbers of seconds. So to get hour.decimalhour divide by 3600 .

 

data example;
   t = '08:30't;
   timenominal = t/3600;
run;

3600 = 60 seconds in hour * 60 minutes in hour.

Tom
Super User Tom
Super User

Divide by one hour.

4782  data _null_;
4783    now=time();
4784    hours=now/'01:00:00't ;
4785    put now= time8. hours= ;
4786  run;

now=8:56:20 hours=8.9389222222

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 967 views
  • 0 likes
  • 3 in conversation