Hi,
How do I subset data based on a time variable? The variable has the time format which makes it look like "21:36:00." I want anyone between 7pm and 12pm?
Num | 8 | TIME. |
use time constant
where time_variable between '7:00pm't and '12:00pm't;
use time constant
where time_variable between '7:00pm't and '12:00pm't;
Do you know if there is a way to combine a date variable and a time variable to create a Datetime variable?
@lalaktgrau wrote:
Do you know if there is a way to combine a date variable and a time variable to create a Datetime variable?
The dhms() function. Use the date as the first and the time as the fourth parameter; set the second and third parameter to zero.
12 pm is (per definition) noon, so your rule would include everything from 19:00 on one day to 12:00 on the next.
I rather guess you want to include everything between '19:00:00't and '24:00:00't;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.