Statalist


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

st: Re: creating number of days per month


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: Re: creating number of days per month
Date   Thu, 5 Nov 2009 06:47:10 -0500

<.>
Here is the relevant chunk of code:

gen date1=date(var1, "DMY")
gen date2=date(var2, "DMY")
drop var1 var2
g patientid = _n
reshape long date, i(patientid)
duplicates list patientid date
duplicates drop patientid date, force
tsset patientid date

On Nov 5, 2009, at 2:33 AM, Raja wrote:

When I run with my original data, I get the following error after the
tsset command.

tsset patientid date
repeated time values within panel

This may be due to the fact that, some patients may be discharged on
the same day of admission.

How to resolve this issue, if the patient is discharged on the same
day as admission.


Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html

*
*   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