Dear all,
I have a simple question regarding moving variables. My dataset looks like that:
ID NVis Var1 Var2 Var3 Var 4
1 0 F 95 0 14oct2002
1 1 F 96 0 04mar2004
1 2 F 98 0 13jan2006
1 3 F 99 0 25jul2007
2 0 F 96 0 25feb2002
2 1 F 96 1 13dec2002
3 0 F 94 0 02mar2002
3 1 F 95 0 11nov2003
3 2 F 99 0 11may2007
3 3 F 99 1 19dec2007
But I want to move all the variables (except ID NVis and Var4) one row above, and obtaining this:
ID NVis Var1 Var2 Var3 Var 4
1 0 . . . 14oct2002
1 1 F 95 0 04mar2004
1 2 F 96 0 13jan2006
1 3 F 98 0 25jul2007
2 0 . . 25feb2002
2 1 F 96 0 13dec2002
3 0 . . . 02mar2002
3 1 F 94 0 11nov2003
3 2 F 95 0 11may2007
3 3 F 99 0 19dec2007
Basically, all the covariates will be moved one row below, resulting in the row at Visit 0 to have all blank and in losing information regarding last NVis for each ID.
Thanks to anyone who will help!
I have a simple question regarding moving variables. My dataset looks like that:
ID NVis Var1 Var2 Var3 Var 4
1 0 F 95 0 14oct2002
1 1 F 96 0 04mar2004
1 2 F 98 0 13jan2006
1 3 F 99 0 25jul2007
2 0 F 96 0 25feb2002
2 1 F 96 1 13dec2002
3 0 F 94 0 02mar2002
3 1 F 95 0 11nov2003
3 2 F 99 0 11may2007
3 3 F 99 1 19dec2007
But I want to move all the variables (except ID NVis and Var4) one row above, and obtaining this:
ID NVis Var1 Var2 Var3 Var 4
1 0 . . . 14oct2002
1 1 F 95 0 04mar2004
1 2 F 96 0 13jan2006
1 3 F 98 0 25jul2007
2 0 . . 25feb2002
2 1 F 96 0 13dec2002
3 0 . . . 02mar2002
3 1 F 94 0 11nov2003
3 2 F 95 0 11may2007
3 3 F 99 0 19dec2007
Basically, all the covariates will be moved one row below, resulting in the row at Visit 0 to have all blank and in losing information regarding last NVis for each ID.
Thanks to anyone who will help!
Comment