data abcd;
input id date encounter;
cards;
1 09APR2012 1
1 11APR2012 1
1 26AUG2012 2
2 10MAY2015 1
2 15AUG2015 2
2 20AUG2015 2
2 02JAN2016 3
2 17MAR2016 4
3 12DEC2013 1
3 18JAN2014 2
4 09SEP2013 1 ; RUN;
I have this dataset that has ID, Date, and encounter. If the dates are within 30 days apart, the encounter remains the same encounter.
I want to say something like "if the person exists only once and has only one encounter, then newvar = 1"
I also want to say "if the person exists multiple times and only has three or less encounters AND those three encounters occur within the same year (365 days), then newvar2 = 1"
I also want to say "if the person exists multiple times and has three or more encounters AND those encounters occur within mutiple years, then newvar3 = 1"
I'm not entirely sure where to start.
... View more