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]
st: highest date in repeated data
From
"Dherani, Mukesh" <[email protected]>
To
"'[email protected]'" <[email protected]>
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/