Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: add up the total stay


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: add up the total stay
Date   Fri, 12 Oct 2007 16:03:52 +0100

This is still, to me, unclear about whether 
your date variables are string or numeric
and about where 0.1 comes from in the last
column. 

Nevertheless Arun in two posts has provided
useful tips. 

Another thing you may be seeking is -egen, 
total()- (-egen, sum()- in old Statas). 

Nick 
[email protected] 

Dndee
 
> Arun Rajamohan
> 
> Thanks for your reply.
> The database is in STATA format and I had better to
> should manage everything there. Total number of
> records is so high that I would prefer to work with
> STATA and not to enter them in Excel. 
> ID	DateCame	DateWent	DateWent-DateCame
> TotalStayEachVisit
> SD101	05-Nov-05	05-Nov-05	0.5	_
> SD101	05-Nov-05	11-Nov-05	6	6.5
> SD101	28-Apr-05	28-Apr-05	0.5	0.5
> SD105	03-Jul-06	03-Jul-06	0.5	0.5
> SD105	29-Mar-06	29-Mar-06	0.5	0.1
> SD105	13-Jan-06	14-Jan-06	1	_
> SD105	10-Jan-06	13-Jan-06	3	4
> SD105	24-May-04	25-May-04	1	1
> SD217	22-Sep-05	22-Sep-05	0.5	0.5
> 
> What I need is calculation of TotalStayEachVisit 
> which depends on 1) ID and 2) number of visits. As can
> be seen in sample some visitors came only to one
> department and some to more than one. I need syntaxes
> in STATA.
> There is no problem with formatting for dates. 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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