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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.