Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: highest date in repeated data


From   "Dherani, Mukesh" <M.K.Dherani@liverpool.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: highest date in repeated data
Date   Wed, 6 Feb 2013 13:26:34 +0000

Dear statalist,
I have panel data in which a child is observed repeatedly at an interval of 6 months at 0,6,12 and 18months. However, some children dropped out at 6 or 12 months.  I want to create a date of exit for them which should be the latest date,  say date of interview on visit at 12 month if 18 month visit did not happen. For example for child 1 below it should be 1/1/2010 and only appear in that row.  I am doing this to carry out 'stset' commands.

child	intervdate	month	exit
1	01/01/2010	0	
1	01/07/2010	6	
1	01/01/2011	12	
2	01/02/2010	0	
2	01/07/2010	6	
2	01/02/2011	12	
2	01/07/2011	18	01/07/2011
3	01/01/2010	0	
3	01/07/2010	6	


How can I copy latest date is not clear.
I tried

replace exit= interdate if month==18
replace exit= interdate if month==12 & missing(interdate)  
		// problem with this is for child 2 it is showing exit=1/2/2011 and final record is excluded

Your help is appreciated (I am using stata 10). Than you in advance.

BW,m


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index