Hi folks, I have a dataset that looks like this: data have;
input studyID mth_date ed_visits year ;
cards;
1 2011-04 0 2011
1 2011-05 1 2011
1 2012-01 3 2012
2 2011-03 4 2011
3 2011-04 2 2011
3 2011-06 0 2011
3 2013-08 2 2013
run; And I'm trying to create a dataset that will tell me which of the study id's have 3 or more ed_visits within 12 months ( we'll call them repeat users). The trick is that I don't care if it's 3 hospitalizations in the same year, just that within any 12 month period they have a total of 3 or more hospitalizations. So Using the above dataset, and creating a binary variable for "repeat user" my output could look something like: data want;
input studyID mth_date ed_visits year Repeat_user ;
cards;
1 2011-04 0 2011 1
1 2011-05 1 2011 1
1 2012-01 3 2012 1
2 2011-03 4 2011 1
3 2011-04 2 2011 0
3 2011-06 0 2011 0
3 2013-08 2 2013 0
run; Study ID's 1 and 2 both have enough hospitalizations to qualify as repeat users (value of 1), but #3 never had more than 2 visits within a 12 month period, so they remain 0's. Alternatively, a list of the study ID's that meet the "repeat user" criteria would also work. Also, just FYI the mnth_date variable is currently not a SAS date, just a string (not my fault that's just how the data came). In essence I need to be able to sort out the people who made 3 or more trips to the ED within 12 months over the course of my study period from those that haven't Any thoughts would be much appreciated! Thanks so much Mike
... View more