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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 484 views
  • 2 likes
  • 2 in conversation