I am using prescription drug claims data and want to identify spells of 3 months of continuous drug use. The individual level panel is unbalanced; the individual shows up in the panel only whenever a prescription is filled. Here is an example:
Code:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long patient_id str10 fill_date int number_of_days_supply 1 "2012-06-15" 3 1 "2012-06-21" 10 1 "2012-06-21" 10 1 "2012-06-21" 10 1 "2018-04-13" 10 2 "2011-10-02" 6 2 "2012-01-14" 3 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-02-28" 6 2 "2012-04-17" 1 2 "2012-04-20" 4 2 "2012-04-22" 6 3 "2012-04-06" 2 3 "2012-04-16" 5 3 "2018-05-06" 7 3 "2018-05-26" 30 3 "2018-07-03" 30 3 "2018-08-14" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-09-17" 30 3 "2018-10-18" 30 3 "2018-11-20" 30 3 "2018-12-24" 30 4 "2010-09-04" 2 end
Many thanks.
Sumedha.
0 Response to Creating spells of 3 months.
Post a Comment