Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Need Help with Stata Programming |
Date | Wed, 20 Nov 2013 13:27:58 +0000 |
A similar question was posted only yesterday http://www.stata.com/statalist/archive/2013-11/msg00745.html and advice included a reference SJ-7-3 pr0033 . . . . . . . . . . . . . . Stata tip 51: Events in intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q3/07 SJ 7(3):440--443 (no commands) tip for counting or summarizing irregularly spaced events in intervals which is accessible at http://www.stata-journal.com/sjpdf.html?articlenum=pr0033 Nick njcoxstata@gmail.com On 20 November 2013 13:11, Michael Stewart <michaelstewartresearch@gmail.com> wrote: > I am trying to measure number of visits/admissions before and after a > particular event and was hoping to get help from Stata programmers in > the Statalist > > My dataset is as follows . ED: stands for emergency department visit & > IP stands for Inpatient admission > > Patients are sorted chronologically (by date). > > My goal is > > 1)Count number of admissions(i.e., admit_type==IP) 60 days before the > event(i.e., event==1) OR 60 days after the event(i.e., event==1). > 2)Sum up the cost of the admissions (i.e., admit_type==IP) 60 days > before the event(i.e., event==1) OR 60 days after the event(i.e., > event==1). > 3 ED 0 date_1 USD xx > 3 IP 0 date_2 USD xx > 3 ED 0 date_3 USD xx > 3 IP 0 date_4 USD xx > 3 IP 1 date_5 USD xx > 3 ED 0 date_6 USD xx > 3 IP 0 date_7 USD xx > 3 ED 0 date_8 USD xx * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/