Hello,
I have a dataset which comes in long format and has 8863 observations. For my analysis, i have reshaped the data from long to wide (see tables below) which allows me to have one row per case. However, when i reshaped to wide format the data then split, meaning that my observations numbers are different from the original. For example for the variables fcacc_mean_acc_24h_1 and fcacc_mean_acc_24h_2, the number are now 4750 and 4113, respectively. I need to have one variable that has all the observation together rather than two? Does anyone have any suggestions? I have tried using stack command but this clears away the variables in memory and i need to keep original variables in memory to merge with my master file using the id variable?
Long format:
Wide format:
Best,
Mohammed
I have a dataset which comes in long format and has 8863 observations. For my analysis, i have reshaped the data from long to wide (see tables below) which allows me to have one row per case. However, when i reshaped to wide format the data then split, meaning that my observations numbers are different from the original. For example for the variables fcacc_mean_acc_24h_1 and fcacc_mean_acc_24h_2, the number are now 4750 and 4113, respectively. I need to have one variable that has all the observation together rather than two? Does anyone have any suggestions? I have tried using stack command but this clears away the variables in memory and i need to keep original variables in memory to merge with my master file using the id variable?
Long format:
MSCID | fcaccad | fcaccmonth | fcaccweekday | fcacc_mean_acc_24h |
M1111111 | 1 | April | Monday | 25 |
M1111111 | 2 | April | Tuesday | 24 |
M2222222 | 1 | November | Wednesday | 12 |
M2222222 | 2 | November | Friday | 13 |
M3333333 | 1 | December | Thursday | 15 |
M3333333 | 2 | December | Monday | 16 |
MSCID | Fcaccmonth_1 | Fcaccweekday_1 | fcacc_mean_acc_24h_1 | Fcaccmonth_2 | Fcaccweekday_2 | fcacc_mean_acc_24h_2 |
M1111111 | April | Monday | 25 | April | Tuesday | 24 |
M2222222 | November | Wednesday | 12 | November | Friday | 13 |
M3333333 | December | Thursday | 15 | December | Monday | 16 |
Mohammed
Comment