Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Need Help with Stata Programming


From   Fabrizio Colella - 1348010 <[email protected]>
To   [email protected]
Subject   Re: st: Need Help with Stata Programming
Date   Wed, 20 Nov 2013 14:36:21 +0100 (CET)

Hi, 

1) I suggest you to create first a variable "period" that identify if the "Date" is before, in the middle, of after the 60 days,
and after count using the command -tab admit_type period-.

2) here you can first create two dummies, assuming values 1 if the admin=="IP" and period==... (depend the values of the variable created at the first stage) and after -egen newvar = total(cost) if dummy1==1 (and the same for dummy2).

I hope I understood what you were looking for...

Cheers

Fabrizio

------------------------------------------

Fabrizio Colella
Bocconi University and
Fondazione Rodolfo DeBenedetti
Milan, Italy
[email protected]

----- Original Message -----
From: "Michael Stewart" <[email protected]>
To: "statalist" <[email protected]>
Sent: Wednesday, November 20, 2013 2:11:25 PM
Subject: st: Need Help with Stata Programming

Hi Everyone,

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).


Can you please help me . Usually, I try myself and shows the code to
the statalist members but here , in this case, I am not sure, where to
start.Sorry.


Pt_id   || admit_type || event ||       Date    ||      Cost
_______________________________________________________
1               ED              0               date_1  USD xx
1               ED              0               date_2  USD xx
1               IP              0               date_3  USD xx
1               IP              1               date_4  USD xx
1               IP              0               date_5  USD xx
1               IP              0               date_6  USD xx
--------------------------------------------------------
2               ED              0               date_1  USD xx
2               IP              1               date_2  USD xx
2               ED              0               date_3  USD xx
2               IP              0               date_4  USD xx
2               ED              0               date_5  USD xx
2               ED              0               date_6  USD xx
2               IP              0               date_7  USD xx
--------------------------------------------------------
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



Thank you very much for your time.


-- 
Thank you ,
Yours Sincerely,
Mike.
*
*   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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index