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!!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: