BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bd_user_10
Quartz | Level 8

Hi,

I need to replace second and minute data. I have the following time variables:

 

Time1                Time2                  Time3
9:30:46.000       10:30:47.099      10:30:47.000
11:09:13.000     12:09:14.021      12:09:14.000
13:20:15.000     14:19:55.648      14:19:55.000

.                         15:00:22.347      15:00:22.000

.                         16:06:55.235      16:06:55.000

 

In Time3, the hour should be the same as Time2 but the minute and second should be the same as Time1 if Time1 not equal to . (dot). 

 

Can someone please help?

1 ACCEPTED SOLUTION
2 REPLIES 2
bd_user_10
Quartz | Level 8
This is the code:
if Time1 ne . then Time3 = hms(hour(Time2),minute(Time1),second(Time1));

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
  • 1019 views
  • 2 likes
  • 2 in conversation