Hi all! I am working on a student school admission data set which has admission status of the child, the order of preference of the schools (applied to), and a bunch of SES variables for each child. I want to create a dummy variable for each school. To be clear, this is how my data looks like-
A,B,C,D,E are school names;a,b,c,d,e are student id's; P1-P5 are the school preferences.
id |
P1 |
P2 |
P3 |
P4 |
P5 |
a |
A |
B |
C |
|
|
b |
C |
B |
A |
D |
|
c |
A |
B |
C |
D |
E |
d |
D |
E |
|
|
|
e |
C |
A |
E |
|
|
I now want to create dummy variables for A, B,C,D,E and make my data set look like this
id |
P1 |
P2 |
P3 |
P4 |
P5 |
A |
B |
C |
D |
E |
a |
A |
B |
C |
|
|
1 |
1 |
1 |
0 |
0 |
b |
C |
B |
A |
D |
|
1 |
1 |
1 |
1 |
0 |
c |
A |
B |
C |
D |
E |
1 |
1 |
1 |
1 |
1 |
d |
D |
E |
|
|
|
0 |
0 |
0 |
1 |
1 |
e |
C |
A |
E |
|
|
1 |
0 |
1 |
0 |
1 |
Obviously tab P1, generate (s) doesn't word here.
Thank you!