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!!
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 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.