--- On Mon, 2/11/09, Willard Hunter wrote:
> Rajaram, 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.
Moving between programs will greatly increase the
chance of errors and reduce the reproducabilty of your
results. This should only be done if it is _absolutely_
necesarry. This is not the case for this problem.
Moreover, the all Stata solution is actually much more
convenient; stealing from Martin's example:
*--------- begin example --------
clear*
inp str10(var1 var2)
"30nov2007" "14feb2008"
"21jan2009" "07apr2009"
"24apr2008" "09jul2008"
"22feb2008" "08may2008"
"01oct2008" "16dec2008"
"13jul2009" "28sep2009"
"04oct2008" "20dec2008"
"07jul2009" "22sep2009"
"03jun2008" "19aug2008"
"11feb2009" "30apr2009"
"31mar2007" "17jun2007"
"01may2007" "19jul2007"
"04apr2007" "22jun2007"
"03jul2008" "20sep2008"
"10jul2007" "27sep2007"
end
gen admi=date(var1, "DMY")
gen discha=date(var2, "DMY")
format admi discha %tdMonth_DD,_CCYY
drop var1 var2
gen diff = discha - admi
list
*------- end example ----------------
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/