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: Identifying visits with 1 time period of an event
From
"Paul O'Brien" <[email protected]>
To
statalist <[email protected]>
Subject
st: Identifying visits with 1 time period of an event
Date
Mon, 17 Feb 2014 20:23:21 +0000
I have longitudinal data on visits to a clinic during which a procedure sometimes occurs.
I want to mark follow-up visits if the procedure occurred and mark the visits within 1 time period of the procedure, as in the last two variables here.
clear
input ///
id time procedure followup followup1
1 1 0 0 0
1 2 1 0 0
1 3 0 1 1
1 4 0 2 0
1 5 0 3 0
2 3 1 0 0
2 4 0 1 1
2 5 0 2 0
2 7 0 3 0
2 8 0 4 0
2 10 0 5 0
3 1 0 0 0
3 2 0 0 0
3 3 0 0 0
3 4 0 0 0
4 2 0 0 0
4 3 1 0 0
4 6 0 1 0
4 7 0 2 0
end
I have struggled with _n and _N but cannot get the follow to start after the event.
Thanks,
Paul
-------------------------------
Dr Paul O'Brien
Raymede Clinic
Westside Contraception and Sexual Health Services
Central London Community Healthcare
Exmoor St
London
W10 6DZ
UK
+44 (0)20 8962 5511
*
* 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/