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));

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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