I am trying to create a sequence number to enumerate the total number of visits to a service (I cannot delete duplicates because of other variables).
I already have a variable that indicates if the client presented unique visits. Therefore, the sequence number should enumerate all visits but keep the same number when any client does not present a unique visit.
I hope you can help me with this since I'm quite new in SAS. Thank you!!
ID | Unique_visit | Total_visits (NEEDED) |
1 | 1 | 1 |
1 | 1 | 2 |
1 | 0 | 2 |
2 | 1 | 3 |
2 | 1 | 4 |
3 | 1 | 5 |
3 | 0 | 5 |
3 | 1 | 6 |
4 | 1 | 7 |
4 | 1 | 8 |
4 | 0 | 8 |
4 | 1 | 9 |
data want;
set have;
Total_visits +unique_visit;
run;
data want;
set have;
Total_visits +unique_visit;
run;
I cannot believe that I was overthinking this. Thank you so much!!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.