I have daily data (one row per day (ignoring missing days))
and want to count months before and after a given "index"
date (which can be any day between 10/1/2012 and 6/30/2013)
each person has one year of data before the index date and
one year after the index date (actually, one year minus 1
day as the index date counts as part of the second year)
so, each person has data for a total of 24 months but these
are not, of course, calendar months as the period can start
on any day in a month
I want to group the data into months (counting either from
-12 to +12 (with the index date part of +1) or from 1 to
24 (with the index date part of month 13))
Ignoring missing days, each person has either 730 days
(rows of data) or 731 (if 2/29/2012 is part of their
first year)
For example, if a person's index date is 15oct2012, then
14oct2012 would be month -1 and 14sep2012 would be part of
month -2, while 14nov2012 would be part of month 1 and
15nov2012 would be part of month 2 (etc.)
the date variable for days is a Stata date with a format
of %td
and want to count months before and after a given "index"
date (which can be any day between 10/1/2012 and 6/30/2013)
each person has one year of data before the index date and
one year after the index date (actually, one year minus 1
day as the index date counts as part of the second year)
so, each person has data for a total of 24 months but these
are not, of course, calendar months as the period can start
on any day in a month
I want to group the data into months (counting either from
-12 to +12 (with the index date part of +1) or from 1 to
24 (with the index date part of month 13))
Ignoring missing days, each person has either 730 days
(rows of data) or 731 (if 2/29/2012 is part of their
first year)
For example, if a person's index date is 15oct2012, then
14oct2012 would be month -1 and 14sep2012 would be part of
month -2, while 14nov2012 would be part of month 1 and
15nov2012 would be part of month 2 (etc.)
the date variable for days is a Stata date with a format
of %td
Comment