Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: highest date in repeated data


From   Jan Ditzen <[email protected]>
To   [email protected]
Subject   Re: st: highest date in repeated data
Date   Wed, 06 Feb 2013 15:04:12 +0100

Hi,
a very simple approach:

sort child month
gen exit = intervdate if child != child[_n+1]

I am sure that there is an alternative approach, but this one should work.

Best,
Jan

Am 06.02.2013 14:26, schrieb Dherani, Mukesh:
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/


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