Statalist


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

st: RE: RE: Creating number of days per month


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Creating number of days per month
Date   Mon, 2 Nov 2009 16:11:33 -0000

This assumes, clearly, that users have access to Filemaker Pro and Excel. Even the second is far from universally true. 

Getting the duration is possible in one line within Stata, so export is not needed for that. 

Getting the new variables is the trickier bit, not addressed here, but 
other posts have shown that it can be done within Stata in about six lines. 

Nick 
[email protected] 

Willard Hunter

an easy way is to transfer the data into a Filemaker Pro database. Then save the dates as
numbers and subtract variable 2 from variable 1. It will give you a clean number of days each
patient was in the facility. Then that data can be transferred back into Stata via Excel.

Rajaram Subramanian Potty

On Mon, Nov 2, 2009 at 10:33 AM, Rajaram Subramanian Potty
<[email protected]> wrote:
> Dear all,
>
> I have the following data indciating the date of visit and date of
> discharge of patients. Now, I want to consturct variables to indicate
> how may days the patient was there in the hospital or centre in a
> month in a particular year. Some patients might have stayed in the
> hospital ever for 2 years. The following is the 101 observations from
> the data set. Var1 is the date of admission and var2 is the date of
> discharge.
>
>
>                var1               var2
> 24400.   30nov2007   14feb2008
> 24401.   21jan2009   07apr2009
> 24402.   24apr2008   09jul2008
> 24403.   22feb2008   08may2008
> 24404.   01oct2008   16dec2008
> 24405.   13jul2009   28sep2009
> 24406.   04oct2008   20dec2008
> 24407.   07jul2009   22sep2009
> 24408.   03jun2008   19aug2008
> 24409.   11feb2009   30apr2009
> 24410.   31mar2007   17jun2007
> 24411.   01may2007   19jul2007
> 24412.   04apr2007   22jun2007
> 24413.   03jul2008   20sep2008
> 24414.   10jul2007   27sep2007
> 24415.   10jul2009   28sep2009
> 24416.   08aug2007   27oct2007
> 24417.   15jun2009   03sep2009
> 24418.   12oct2007   31dec2007
> 24419.   20dec2008   11mar2009
> 24420.   04aug2009   24oct2009
> 24421.   01nov2008   21jan2009
> 24422.   04dec2008   23feb2009
> 24423.   31jul2009   21oct2009
> 24424.   03feb2009   26apr2009
> 24425.   24jul2007   14oct2007
> 24426.   16apr2009   07jul2009
> 24427.   23nov2007   14feb2008
> 24428.   15apr2008   07jul2008
> 24429.   01oct2008   23dec2008
> 24430.   30sep2008   23dec2008
> 24431.   07jul2007   29sep2007
> 24432.   14oct2008   07jan2009
> 24433.   15apr2009   09jul2009
> 24434.   02nov2007   27jan2008
> 24435.   30apr2009   26jul2009
> 24436.   15apr2008   11jul2008
> 24437.   27mar2009   23jun2009
> 24438.   01apr2007   29jun2007
> 24439.   07jan2008   05apr2008
> 24440.   09apr2009   07jul2009
> 24441.   21feb2009   23may2009
> 24442.   03dec2008   04mar2009
> 24443.   02jun2009   02sep2009
> 24444.   01apr2009   03jul2009
> 24445.   01apr2009   03jul2009
> 24446.   17apr2008   20jul2008
> 24447.   05may2007   08aug2007
> 24448.   19dec2007   27mar2008
> 24449.   26jun2007   04oct2007
> 24450.   29nov2008   09mar2009
> 24451.   28jan2009   08may2009
> 24452.   01oct2007   11jan2008
> 24453.   01jul2009   13oct2009
> 24454.   25dec2007   08apr2008
> 24455.   30apr2007   14aug2007
> 24456.   19jun2007   03oct2007
> 24457.   01apr2007   16jul2007
> 24458.   19mar2008   07jul2008
> 24459.   07sep2007   26dec2007
> 24460.   09jan2008   30apr2008
> 24461.   10nov2008   02mar2009
> 24462.   09jan2008   30apr2008
> 24463.   12may2008   03sep2008
> 24464.   06jun2009   30sep2009
> 24465.   06jan2009   02may2009
> 24466.   02apr2008   28jul2008
> 24467.   19may2008   15sep2008
> 24468.   21aug2008   19dec2008
> 24469.   21nov2007   24mar2008
> 24470.   04apr2009   08aug2009
> 24471.   19jun2007   24oct2007
> 24472.   15may2009   26sep2009
> 24473.   13nov2008   29mar2009
> 24474.   20aug2007   13jan2008
> 24475.   14oct2008   10mar2009
> 24476.   29nov2008   25apr2009
> 24477.   18sep2007   14feb2008
> 24478.   30apr2009   26sep2009
> 24479.   10apr2007   08sep2007
> 24480.   05apr2008   03sep2008
> 24481.   05mar2008   08aug2008
> 24482.   21apr2009   29sep2009
> 24483.   26feb2009   08aug2009
> 24484.   03feb2009   19jul2009
> 24485.   28apr2007   18oct2007
> 24486.   04apr2007   28sep2007
> 24487.   29apr2007   25oct2007
> 24488.   09jan2008   09jul2008
> 24489.   07oct2007   08apr2008
> 24490.   20feb2009   07sep2009
> 24491.   12may2008   07dec2008
> 24492.   04may2007   18dec2007
> 24493.   05may2007   06jan2008
> 24494.   26jun2007   16mar2008
> 24495.   22may2007   16feb2008
> 24496.   10apr2007   11jan2008
> 24497.   24feb2007   19dec2007
> 24498.   02may2007   04mar2008
> 24499.   28apr2007   10mar2008
> 24500.   17apr2007   08mar2008

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index