I would like to do this in SAS. I will get two dates from the user. For example, the start date is 12/1/2022 and the end date is 12/21/2022 in this example below. After these two inputs, I also get a third input from the user, group#. If the group# is 1, then all dates the dates get a number starting from 1 to whatever is the last number applicable. If the group# is 2, then the first two dates (12/1 and 12/2) in this case below, gets a number of 1, 12/3 and 12/4 gets a number of 2. It is liking clubbing the dates into chunks that is determined by the group#. Group#3 would chunk the dates into set of 3. 12/1, 12/2 and 12/3 would get a value of 1. the next three dates would get a value of 2 so on and so forth.
Hi Paige and Rob
Sorry for the confusion. I did not clearly specify what I want . Here is my clarification. My inputs are
(a) lets say these three dates is what I have as my input. I want to chunk ify them. Pls see below.
(b) WindowNumber . Lets say Windownumber=2 (this means i want to chunk my date inputs into a set of 2 timechunks). what i want is a subset of this table below.
That is essentially this below. Essentially want the code to chunk-ify all the dates in between into Windownumbers and just give this small subset below.
Please let me know if this is not clear.
data have; input Date mmddyy10.; datalines; 1/4/2022 1/7/2022 1/8/2022 ; data want(drop=first); set have; retain first; if _N_ = 1 then first = Date; Group2 = 1 + floor((Date-first)/2); run; proc print data=want; format Date mmddyy10.; run;
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.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.