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]

st: Dummy variable transformation replacing missing data


From   Joe Dreyfus <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Dummy variable transformation replacing missing data
Date   Mon, 11 Jun 2012 14:54:30 +0200

Hi Statalist,

I have the following data.

id t x z y
1 1 1 . . .
2 1 2 1 0 0
3 1 3 . . .
4 2 1 0 1 0
5 2 2 . . .
6 2 3 . . .
7 2 4 . . .
8 2 5 . . .
9 3 1 . . .
10 3 2 0 0 1
11 3 3 . . .
12 3 4 . . .
13 3 5 . . .
14 3 6 . . .


And would like to transform the data as  follows:

id t x z y x' z' y'
1 1 1 . . . 1 0 0
2 1 2 1 0 0 1 0 0
3 1 3 . . . 1 0 0
4 2 1 0 1 0 0 1 0
5 2 2 . . . 0 1 0
6 2 3 . . . 0 1 0
7 2 4 . . . 0 1 0
8 2 5 . . . 0 1 0
9 3 1 . . . 1 0 1
10 3 2 0 0 1 1 0 1
11 3 3 . . . 1 0 1
12 3 4 . . . 1 0 1
13 3 5 . . . 1 0 1
14 3 6 . . . 1 0 1
The time period where the indicator is on is not relevant. I just need to know how to transform the variable so that if it is swtiched on in one time period it is transformed to be switched on for all time periods. 

Thanks in advance!

Joe


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index