Hi, all
I have the original data set like this:
Male Female V1 V2 V3 V4
3 2 2 4 5 7
2 3 6 9 3 8
Now I want to transform it into a new data set. Instead of male and female, now I have a new variable "gender", and gender=0 for male, gender=1 for female. If male=3, then repeat the observation 3 times with gender=0; if female=2, then repeat the observation 2 times with gender=1.
The transformed data set should look like:
Gender V1 V2 V3 V4
0 2 4 5 7
0 2 4 5 7
0 2 4 5 7
1 2 4 5 7
1 2 4 5 7
0 6 9 3 8
0 6 9 3 8
1 6 9 3 8
1 6 9 3 8
1 6 9 3 8
This task is really tricky for me. Wonder whether anyone have an idea of how to implement it. Thanks a lot!