I’m a SAS new learner and I have a problem that I haven’t able to solve.
I’m trying to process two variables ‘bedtime’ and ‘time to get up’, but my row data has only separated hours and minutes, so that I would like to concatenate them into HH:MM 24hours format (00:00). I was trying to do it through both compress function and cat function but not matter which procedure I have applied I just could obtain results as this: 1130, 120, 20, 210, etc.
So, it does not allow me to make a subtraction between the previous variables that I mentioned (‘bedtime’ and ‘time to get up’), so I would really appreciate your help.
WHAT I HAVE WHAT I WANT TO HAVE
BEDTIME TIME TO GET UP BEDTIME TIME TO GET UP TIME DIF
HOUR MIN HOUR MIN
23 0 5 0 23:00 05:00 6
0 30 4 0 00:00 04:00 4
1 45 7 30 01:45 07:30 5:45
22 0 7 15 22:00 07:15 9:15
/**Laying Down Time**/
/*PROC_ASSIGNING VALUES_Bedtime combining Hours and Minutes*/
BT = CATS (OF C3_0 C3_1);
/*PROC_COMPRESSING_Bedtime combining Hours and Minutes*/
/**Time to get up **/
/*PROC_ASSIGNING VALUES_time to get up combining Hours and Minutes*/
TGU= CATS (OF C3_2 C3_3) ;
/*PROC__COMPRESSING_time to get up combining Hours and Minutes*/
/*PROC_Bedtime-Time to get up*/
BTTGUDT= TGU-BT ;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.