Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Programming Question


From   "Anthony Gichangi" <[email protected]>
To   <[email protected]>
Subject   st: Programming Question
Date   Thu, 27 Nov 2003 08:42:55 +0100

Dear Stata Users,
I have a dataset with three variables ID Dates and Type. I have listed the
data
for subject number 1
ID  Date          Type
1   05 Jan 96    CAB
1   05 Jan 96    OTH
1   02 Feb 96   CAB
1  11 Mar 96    CAB
1  15 Apr 96     CAB
1  15 Apr 96     OTH
1  23 Jul 96     CAB
1  23 Jul 96     CAB
1  02 Sep 96    OXY
1  02 Sep 96    CAB
1  30 Sep 96    OTH
1  01 Nov 96    OTH
1  22 Nov 96    OXY
1  22 Nov 96    CAB
1  16 Dec 96   OXY
1  16 Dec 96   CAB
1  16 Dec 96   OTH


Now I have defined three months overlapping interval with two months overlap
in which I want to
see what is happening to the subjects. So that Interval number 1 is Jan Feb
March, number 2 is Feb
march April and No3 is March April May e.t.c until Dec.  Then define a new
variable Y(t) which captures
the information in each interval as follows

Y(t) =0 if nothing
     = 1 if CAB only
    = 2  if OXY only
   =  3   if  OTHERS only
   =  4  if  OXY+CAB
   =  5  if  CAB+OTHERS
   =  6   if  OXY+OTHERS
   =  7    if  OXY+CAB+OTHERS

Then the final dataset should look like this
ID interval Y(t)
1    1        5
1    2        1
1    3        5
.
.
.
Any ideas how I can do this  in stata ?

With kind Regards
Anthony

*
*   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