Hi - I need assistance with reshaping data.
I have a dataset that looks like this where data from redcap is imported into separate forms and then the variables for each form are listed horizontally. I am struggling with the reshape command because the data is both long and wide at the same time.
I would like to have a single row per study id number with all the data in wide form.
This is what the data currently looks like.
And this is what I would like it to look like:
Thanks in advance for your help!
Ribka
I have a dataset that looks like this where data from redcap is imported into separate forms and then the variables for each form are listed horizontally. I am struggling with the reshape command because the data is both long and wide at the same time.
I would like to have a single row per study id number with all the data in wide form.
This is what the data currently looks like.
studyID | form | form_a_var_1 | form_a_var_2 | form_a_var_3 | form_b_var_1 | form_b_var_2 | form_b_var_3 |
1 | a | x | x | x | |||
1 | b | x | x | x | |||
2 | a | x | x | x | |||
2 | b | x | x | x |
studyID | form | form_a_var_1 | form_a_var_2 | form_a_var_3 | form_b_var_1 | form_b_var_2 | form_b_var_3 |
1 | a | x | x | x | x | x | x |
2 | a | x | x | x | x | x | x |
Ribka