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?
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.