I need to extract and label records that are dated between yesterday at 16:00:00 hours and today up to 15:59:00 hours (using datetime 'dt).
Is there a function or a combination thereof that I can use to label the records that meet the criteria between those two timestamps? Currently, this is the code (listed below) but I need to make the code generic so daily code updates are not needed.
if TIMESTAMP >= '16Jan19:16:00:00'dt and TIMESTAMP <= '17Jan19:15:59:00'dt then process_date = Today () function; (setup as a macro);
dhms( today() - 1 , 16,0,0 )
dhms( today(), 15,59,0 )
dhms( today() - 1 , 16,0,0 )
dhms( today(), 15,59,0 )
Thank you. This was the simplest solution and works well within the datastep.
Cheers!
Hi @cgant29 Can you please provide a sample of your data and your requirement. That could help us test and offer you a solution
Please note that the code currently being used is in the original post.
Below are the dates pulled in (on any given day):
12/10/2018 8:55 |
12/10/2018 9:45 |
12/10/2018 9:48 |
12/10/2018 9:57 |
12/10/2018 10:10 |
12/10/2018 10:19 |
12/10/2018 10:24 |
12/10/2018 10:44 |
12/10/2018 10:49 |
12/10/2018 13:33 |
12/10/2018 13:38 |
12/10/2018 15:03 |
12/10/2018 15:32 |
12/10/2018 16:00 |
12/10/2018 17:20 |
12/10/2018 17:38 |
12/10/2018 19:25 |
12/10/2018 20:27 |
12/10/2018 20:44 |
12/10/2018 20:52 |
12/10/2018 22:03 |
12/10/2018 22:17 |
12/11/2018 4:13 |
12/11/2018 6:54 |
12/11/2018 6:56 |
12/11/2018 6:58 |
12/11/2018 7:33 |
12/11/2018 7:45 |
12/11/2018 7:45 |
12/11/2018 8:32 |
12/11/2018 9:10 |
12/11/2018 10:18 |
12/11/2018 10:19 |
12/11/2018 11:53 |
12/11/2018 12:25 |
12/11/2018 14:44 |
12/11/2018 19:43 |
12/11/2018 20:09 |
12/11/2018 20:56 |
12/12/2018 8:29 |
12/12/2018 9:11 |
12/12/2018 9:27 |
12/12/2018 9:55 |
12/12/2018 11:23 |
12/12/2018 11:49 |
12/12/2018 12:19 |
12/12/2018 12:57 |
12/12/2018 15:07 |
12/12/2018 15:22 |
12/12/2018 15:27 |
12/12/2018 16:54 |
12/12/2018 18:20 |
12/12/2018 18:27 |
12/12/2018 19:36 |
12/13/2018 7:19 |
12/13/2018 9:30 |
12/13/2018 10:42 |
12/13/2018 11:38 |
12/13/2018 11:39 |
12/13/2018 12:03 |
12/13/2018 13:08 |
12/13/2018 13:13 |
12/13/2018 15:41 |
12/13/2018 17:52 |
12/13/2018 18:09 |
12/14/2018 9:42 |
12/14/2018 10:05 |
12/14/2018 10:32 |
12/14/2018 11:02 |
12/14/2018 11:04 |
12/14/2018 11:13 |
12/14/2018 11:46 |
12/14/2018 11:46 |
12/14/2018 12:59 |
12/14/2018 13:09 |
12/14/2018 13:20 |
12/14/2018 13:23 |
12/14/2018 13:27 |
12/14/2018 14:09 |
12/14/2018 14:13 |
12/14/2018 14:18 |
12/14/2018 14:21 |
12/14/2018 14:56 |
12/14/2018 14:59 |
12/14/2018 15:12 |
12/14/2018 15:24 |
12/14/2018 16:20 |
12/14/2018 17:14 |
12/14/2018 20:54 |
12/14/2018 21:07 |
12/14/2018 22:36 |
12/15/2018 8:08 |
12/15/2018 12:28 |
12/15/2018 12:50 |
12/15/2018 13:07 |
12/15/2018 14:59 |
12/15/2018 16:22 |
12/15/2018 18:15 |
12/15/2018 18:42 |
12/15/2018 19:30 |
12/15/2018 23:21 |
12/16/2018 10:40 |
12/16/2018 14:05 |
12/16/2018 15:34 |
12/16/2018 16:05 |
12/16/2018 19:09 |
12/16/2018 22:45 |
12/16/2018 22:49 |
12/16/2018 23:02 |
12/17/2018 0:20 |
12/17/2018 7:14 |
12/17/2018 8:27 |
12/17/2018 8:31 |
12/17/2018 10:10 |
12/17/2018 10:53 |
12/17/2018 11:03 |
12/17/2018 15:36 |
12/17/2018 16:59 |
12/17/2018 17:05 |
12/18/2018 8:56 |
12/18/2018 9:22 |
12/18/2018 9:22 |
12/18/2018 10:04 |
12/18/2018 10:12 |
12/18/2018 10:52 |
12/18/2018 11:53 |
12/18/2018 11:55 |
12/18/2018 13:12 |
12/18/2018 14:05 |
12/18/2018 14:59 |
12/18/2018 15:47 |
12/18/2018 20:49 |
12/18/2018 22:10 |
12/19/2018 10:22 |
12/19/2018 11:06 |
12/19/2018 11:38 |
12/19/2018 13:05 |
12/19/2018 13:43 |
12/19/2018 15:35 |
12/19/2018 16:42 |
12/19/2018 20:29 |
12/20/2018 11:55 |
12/20/2018 12:26 |
12/20/2018 12:55 |
12/20/2018 13:41 |
12/20/2018 14:04 |
12/20/2018 14:35 |
12/20/2018 15:15 |
12/20/2018 15:24 |
12/20/2018 15:42 |
12/20/2018 16:55 |
12/20/2018 17:04 |
12/21/2018 1:28 |
12/21/2018 8:17 |
12/21/2018 9:14 |
12/21/2018 10:22 |
12/21/2018 12:14 |
12/21/2018 12:26 |
12/21/2018 14:52 |
12/22/2018 9:24 |
12/22/2018 12:32 |
12/22/2018 13:38 |
12/23/2018 11:08 |
12/24/2018 4:00 |
12/24/2018 6:54 |
12/24/2018 9:13 |
12/24/2018 10:57 |
12/24/2018 12:31 |
12/24/2018 13:20 |
12/24/2018 15:39 |
12/24/2018 16:31 |
12/25/2018 8:58 |
12/25/2018 20:15 |
12/25/2018 20:54 |
12/25/2018 23:00 |
12/25/2018 23:02 |
12/26/2018 0:30 |
12/26/2018 10:10 |
12/26/2018 12:33 |
12/26/2018 14:31 |
12/26/2018 14:57 |
12/26/2018 17:12 |
12/26/2018 17:59 |
12/26/2018 19:45 |
12/27/2018 6:58 |
12/27/2018 9:07 |
12/27/2018 9:29 |
12/27/2018 10:49 |
12/27/2018 12:29 |
12/27/2018 13:02 |
12/27/2018 14:00 |
12/27/2018 16:28 |
12/27/2018 17:17 |
12/27/2018 22:01 |
12/28/2018 2:19 |
12/28/2018 8:20 |
12/28/2018 9:53 |
12/28/2018 10:47 |
12/28/2018 13:35 |
12/28/2018 14:45 |
12/28/2018 15:12 |
12/28/2018 15:33 |
12/29/2018 11:29 |
12/29/2018 11:33 |
12/29/2018 11:36 |
12/29/2018 11:58 |
12/29/2018 13:41 |
12/29/2018 15:40 |
12/29/2018 16:40 |
12/29/2018 17:08 |
12/29/2018 21:15 |
12/30/2018 11:45 |
12/30/2018 14:09 |
12/30/2018 15:10 |
12/30/2018 15:55 |
12/30/2018 23:35 |
12/31/2018 0:04 |
12/31/2018 10:45 |
12/31/2018 11:08 |
12/31/2018 11:24 |
12/31/2018 11:33 |
12/31/2018 13:05 |
12/31/2018 16:38 |
12/31/2018 16:50 |
1/1/2019 11:03 |
1/1/2019 14:28 |
1/2/2019 9:04 |
1/2/2019 10:19 |
1/2/2019 11:08 |
1/2/2019 12:56 |
1/2/2019 13:56 |
1/2/2019 14:45 |
1/2/2019 14:56 |
1/2/2019 15:04 |
1/2/2019 15:18 |
1/2/2019 15:26 |
1/2/2019 17:35 |
1/2/2019 17:49 |
1/2/2019 17:50 |
1/2/2019 18:16 |
1/2/2019 18:25 |
1/2/2019 18:28 |
1/2/2019 20:51 |
1/2/2019 20:54 |
1/2/2019 20:56 |
1/2/2019 20:59 |
1/3/2019 11:00 |
1/3/2019 11:13 |
1/3/2019 14:29 |
1/3/2019 14:55 |
1/3/2019 15:01 |
1/3/2019 15:23 |
1/3/2019 15:42 |
1/3/2019 16:35 |
1/3/2019 16:43 |
1/3/2019 16:56 |
1/3/2019 17:20 |
1/3/2019 17:54 |
1/3/2019 18:03 |
1/3/2019 18:07 |
1/3/2019 18:12 |
1/3/2019 21:56 |
1/3/2019 21:56 |
1/3/2019 22:13 |
1/4/2019 7:51 |
1/4/2019 8:48 |
1/4/2019 9:21 |
1/4/2019 9:50 |
1/4/2019 9:57 |
1/4/2019 11:23 |
1/4/2019 12:37 |
1/4/2019 12:55 |
1/4/2019 12:55 |
1/4/2019 13:13 |
1/4/2019 13:34 |
1/4/2019 13:49 |
1/4/2019 14:08 |
1/4/2019 15:45 |
1/4/2019 18:04 |
1/4/2019 21:11 |
1/5/2019 13:58 |
1/5/2019 14:32 |
1/5/2019 18:53 |
1/6/2019 12:12 |
1/6/2019 12:40 |
1/6/2019 15:03 |
1/6/2019 19:39 |
1/7/2019 0:23 |
1/7/2019 0:26 |
1/7/2019 9:50 |
1/7/2019 9:53 |
1/7/2019 10:00 |
1/7/2019 12:34 |
1/7/2019 12:42 |
1/7/2019 13:24 |
1/7/2019 13:33 |
1/7/2019 13:53 |
1/7/2019 13:57 |
1/7/2019 16:29 |
1/7/2019 18:06 |
1/8/2019 0:57 |
1/8/2019 3:42 |
1/8/2019 6:56 |
1/8/2019 9:25 |
1/8/2019 13:02 |
1/8/2019 14:09 |
1/8/2019 14:54 |
1/8/2019 15:22 |
1/8/2019 15:41 |
1/8/2019 16:23 |
1/8/2019 16:24 |
1/8/2019 16:29 |
1/8/2019 16:53 |
1/8/2019 17:59 |
1/8/2019 23:16 |
1/9/2019 5:24 |
1/9/2019 6:31 |
1/9/2019 6:56 |
1/9/2019 7:23 |
1/9/2019 8:58 |
1/9/2019 10:37 |
1/9/2019 10:39 |
1/9/2019 10:48 |
1/9/2019 10:50 |
1/9/2019 11:49 |
1/9/2019 12:46 |
1/9/2019 12:48 |
1/9/2019 13:14 |
1/9/2019 16:44 |
1/9/2019 16:46 |
1/9/2019 16:47 |
1/9/2019 17:01 |
1/9/2019 17:23 |
1/9/2019 18:33 |
1/9/2019 18:35 |
1/9/2019 19:14 |
1/9/2019 19:31 |
1/9/2019 20:05 |
1/9/2019 20:55 |
1/9/2019 22:12 |
1/9/2019 23:54 |
1/10/2019 0:37 |
1/10/2019 1:13 |
1/10/2019 1:17 |
1/10/2019 6:41 |
1/10/2019 7:36 |
1/10/2019 7:50 |
1/10/2019 8:00 |
1/10/2019 8:07 |
1/10/2019 8:52 |
1/10/2019 10:45 |
1/10/2019 11:20 |
1/10/2019 12:07 |
1/10/2019 12:50 |
1/10/2019 13:44 |
1/10/2019 13:51 |
1/10/2019 14:48 |
1/10/2019 17:43 |
1/11/2019 7:57 |
1/11/2019 8:22 |
1/11/2019 8:32 |
1/11/2019 8:49 |
1/11/2019 10:42 |
1/11/2019 11:17 |
1/11/2019 11:52 |
1/11/2019 12:10 |
1/11/2019 12:10 |
1/11/2019 13:06 |
1/11/2019 13:26 |
1/11/2019 13:49 |
1/11/2019 14:16 |
1/11/2019 14:56 |
1/11/2019 14:57 |
1/11/2019 23:12 |
1/12/2019 6:05 |
1/12/2019 7:55 |
1/12/2019 8:24 |
1/12/2019 17:41 |
1/12/2019 18:21 |
1/12/2019 22:36 |
1/13/2019 7:56 |
1/13/2019 8:00 |
1/13/2019 8:17 |
1/13/2019 12:57 |
1/13/2019 13:06 |
1/13/2019 14:06 |
1/13/2019 19:48 |
1/13/2019 21:11 |
1/13/2019 21:25 |
1/13/2019 22:14 |
1/14/2019 2:10 |
1/14/2019 3:32 |
1/14/2019 8:08 |
1/14/2019 10:00 |
1/14/2019 10:10 |
1/14/2019 10:14 |
1/14/2019 10:33 |
1/14/2019 10:44 |
1/14/2019 11:56 |
1/14/2019 11:56 |
1/14/2019 11:59 |
1/14/2019 12:02 |
1/14/2019 13:02 |
1/14/2019 13:05 |
1/14/2019 13:48 |
1/14/2019 14:25 |
1/14/2019 14:31 |
1/14/2019 14:32 |
1/14/2019 14:35 |
1/14/2019 14:54 |
1/14/2019 15:18 |
1/14/2019 15:20 |
1/14/2019 15:28 |
1/14/2019 15:45 |
1/14/2019 15:48 |
1/14/2019 15:50 |
1/14/2019 16:54 |
1/14/2019 17:12 |
1/14/2019 17:28 |
1/14/2019 18:09 |
1/14/2019 19:30 |
1/14/2019 21:30 |
1/14/2019 22:10 |
1/15/2019 6:10 |
1/15/2019 8:11 |
1/15/2019 10:03 |
1/15/2019 10:05 |
1/15/2019 10:15 |
1/15/2019 10:17 |
1/15/2019 11:10 |
1/15/2019 11:11 |
1/15/2019 11:28 |
1/15/2019 11:33 |
1/15/2019 11:35 |
1/15/2019 11:40 |
1/15/2019 11:44 |
1/15/2019 12:07 |
1/15/2019 13:02 |
1/15/2019 13:13 |
1/15/2019 14:23 |
1/15/2019 14:23 |
1/15/2019 14:57 |
1/15/2019 15:44 |
1/15/2019 15:56 |
1/15/2019 15:56 |
1/15/2019 15:59 |
1/15/2019 16:07 |
1/15/2019 16:47 |
1/15/2019 16:51 |
1/15/2019 17:53 |
1/15/2019 20:25 |
1/15/2019 22:12 |
1/16/2019 6:38 |
1/16/2019 6:41 |
1/16/2019 6:48 |
1/16/2019 8:45 |
1/16/2019 8:51 |
1/16/2019 9:36 |
1/16/2019 10:02 |
1/16/2019 10:04 |
1/16/2019 10:18 |
1/16/2019 10:33 |
1/16/2019 11:01 |
1/16/2019 11:19 |
1/16/2019 11:46 |
1/16/2019 12:36 |
1/16/2019 12:41 |
1/16/2019 12:42 |
1/16/2019 13:08 |
1/16/2019 13:38 |
1/16/2019 13:52 |
1/16/2019 14:54 |
1/16/2019 14:55 |
1/16/2019 15:10 |
1/16/2019 16:55 |
1/16/2019 17:41 |
1/16/2019 18:58 |
1/16/2019 21:12 |
1/16/2019 22:31 |
1/17/2019 8:35 |
1/17/2019 9:02 |
1/17/2019 10:35 |
1/17/2019 10:56 |
1/17/2019 11:56 |
1/17/2019 12:50 |
1/17/2019 13:13 |
1/17/2019 13:17 |
1/17/2019 13:23 |
1/17/2019 13:35 |
1/17/2019 13:47 |
1/17/2019 14:56 |
1/17/2019 15:10 |
1/17/2019 15:14 |
1/17/2019 15:31 |
1/17/2019 16:16 |
1/17/2019 16:40 |
1/17/2019 17:01 |
1/17/2019 17:07 |
1/17/2019 21:44 |
1/18/2019 1:19 |
1/18/2019 2:22 |
1/18/2019 6:12 |
1/18/2019 7:01 |
1/18/2019 7:20 |
1/18/2019 8:20 |
1/18/2019 8:20 |
1/18/2019 9:58 |
1/18/2019 10:05 |
1/18/2019 10:08 |
1/18/2019 10:33 |
1/18/2019 10:42 |
1/18/2019 10:48 |
1/18/2019 11:04 |
1/18/2019 11:19 |
1/18/2019 11:28 |
1/18/2019 11:30 |
When running the daily SAS today, only relevant rows are between 16:00:00 the previous day thru today at 15:59:00 (label 18Jan19).
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: