Hi everyone,
I am trying to calculate the number of visits in a 14-day episode. All the visits within 14 days of an index visit count as an episode. The index visit is visit #0. The date is in mmddyy format.
data have -
ID date index episode_visits episode_visits_total
1 1/1/2018 1 0 .
1 1/2/2018 0 1 .
1 1/3/2018 0 2 2
1 1/1/2019 1 0 .
1 1/18/2019 1 0 .
My question is, how do I populate the total episode visits when they are 0 (no subsequent visits).
data want -
ID date index episode_visits episode_visits_total
1 1/1/2018 1 0 .
1 1/2/2018 0 1 .
1 1/3/2018 0 2 2
1 1/1/2019 1 0 0
1 1/18/2019 1 0 0
Thank you!!
I am trying to calculate the number of visits in a 14-day episode. All the visits within 14 days of an index visit count as an episode. The index visit is visit #0. The date is in mmddyy format.
data have -
ID date index episode_visits episode_visits_total
1 1/1/2018 1 0 .
1 1/2/2018 0 1 .
1 1/3/2018 0 2 2
1 1/1/2019 1 0 .
1 1/18/2019 1 0 .
My question is, how do I populate the total episode visits when they are 0 (no subsequent visits).
data want -
ID date index episode_visits episode_visits_total
1 1/1/2018 1 0 .
1 1/2/2018 0 1 .
1 1/3/2018 0 2 2
1 1/1/2019 1 0 0
1 1/18/2019 1 0 0
Thank you!!
1. Merged duplicate posts.
- It is rude to do this as you are asking people to work for you while possibly duplicating efforts
- This question does not belong in Data Management
2. You goal in unclear. When are zeros added an when not?
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.