Starting with the dataset below, we need to identify the index encounter, which is the encounter_date closest to the start_date.
Encounter_date may be up to two weeks prior to intake survey date(start_Date) through 1 week after it
We also need to apply a washout period. To qualify as an index encounter, there must be no other encounters within 183 days prior to the 2 week grace period, up to two weeks before the index period.
Person_ID Encoured_Date Start_Date
00006A7087 10/7/2021 4/5/2022
00006A7087 11/5/2021 4/5/2022
00006A7087 11/15/2021 4/5/2022
00006A7087 12/2/2021 4/5/2022
00006A7087 12/14/2021 4/5/2022
00006A7087 12/21/2021 4/5/2022
00006A7087 1/3/2022 4/5/2022
00006A7087 1/18/2022 4/5/2022
00006A7087 1/25/2022 4/5/2022
00006A7087 2/4/2022 4/5/2022
00006A7087 2/8/2022 4/5/2022
00006A7087 2/17/2022 4/5/2022
00006A7087 3/2/2022 4/5/2022
00006A7087 3/8/2022 4/5/2022
00006A7087 3/18/2022 4/5/2022
00006A7087 4/5/2022 4/5/2022
00006A7087 4/12/2022 4/5/2022
0000E20E92 1/28/2022 4/5/2022
0000E20E92 3/22/2022 4/5/2022
0000E20E92 4/5/2022 4/5/2022
0000E20E92 5/3/2022 4/5/2022
0000E20E92 5/17/2022 4/5/2022
0000E20E92 5/31/2022 4/5/2022
0000E20E92 7/15/2022 4/5/2022
0000E20E92 8/9/2022 4/5/2022
0000E20E92 10/19/2022 4/5/2022
0000E20E92 11/30/2022 4/5/2022
I know how to go 1 week forward and two weeks backward using the intnx function. I however don'w know about how to construct the washout period part.
@mauri0623 wrote:
Starting with the dataset below, we need to identify the index encounter, which is the encounter_date closest to the start_date.
Encounter_date may be up to two weeks prior to intake survey date(start_Date) through 1 week after it
We also need to apply a washout period. To qualify as an index encounter, there must be no other encounters within 183 days prior to the 2 week grace period, up to two weeks before the index period.<data removed>
I know how to go 1 week forward and two weeks backward using the intnx function. I however don'w know about how to construct the washout period part.
I do not see any clear rules defining what the "washout period" is. Or what "apply" means.
You are using terms that are likely intimately familiar to you. However, I do not know exactly what your definition of grace period is or when it starts.
Is 183 days actually days or a supposed to be "6 months" or similar?
@mauri0623 wrote:
Washout is 183 days from the grace period of the one week forward and two weeks backward.
One week forward from which specific date (or exactly how to derive that date given your example data set), similar "two weeks backward" from which date? And weeks may need some clarification. The day at the start of the week? Do you use Sunday, Monday or a different day of the week as start? Or is "week" exactly 7 days? Or the Sunday of the week that is 7 days prior (or after?). Or the first working day of week?
Date intervals need very explicit rules and unfortunately there are multiple definitions of some of these. Look at the WEEK function documentation for example. It has 3 values for a parameter that are involved in defining the starting day of a "week" at the beginning of a year.
You should show an example of the desired output so that we can see how you use your rules and to show the result after the "apply" as in "We also need to apply a washout period." Does apply mean set a flag? Remove observations? Add some value to an existing variable? Create additional observations?
"identify the index encounter, which is the encounter_date closest to the start_date"
Questions:
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.