Hello,
I am relatively new to Stata and I am confused at how to approach problem. I read through gen, egen, and what I could find that seemed relevant in the forloops help guide. This may be a case of misunderstanding loops or not searching the correct terms used in Stata. Also, please forgive me for not using dataex as this dataset and question would contain PHI.
I have recreated the example substituting names in the data that are of equivalent type but are not PHI.
Example (have):
I would like to create a variable that will have a completed column of Randomization values based on what the ID's respective Randomization value is in Round 1. Each ID value does not have the same number of Rounds as some patients completed the entire study, while others had differing completion of the Rounds.
Example (want):
Thank you in advance,
LH
I am relatively new to Stata and I am confused at how to approach problem. I read through gen, egen, and what I could find that seemed relevant in the forloops help guide. This may be a case of misunderstanding loops or not searching the correct terms used in Stata. Also, please forgive me for not using dataex as this dataset and question would contain PHI.
I have recreated the example substituting names in the data that are of equivalent type but are not PHI.
- I have a numeric ID variable "ID" that has multiple of the same value within the column. This is not the primary identifier in the dataset and I am assuming this is a reason for why it has multiples of the same value.
- I have a string variable indicating the round of visit, i.e. Round 1, Round 1.2, Round 2 where each round represents some specific activity.
- I have a randomization status variable (string) that represents what the random assignment was, i.e. Group 1 or Group 2.
- The dataset was given to me as "complete" and so at this point I do not have the option of going back to look at potential flaws from the merges of separate spreadsheet files.
Example (have):
ID | Round (string) | Randomization |
1 | Round 1 | Group 1 |
2 | Round 1 | Group 2 |
3 | Round 1 | Group 1 |
1 | Round 1.2 | |
2 | Round 1.2 | |
3 | Round 1.2 | |
1 | Round 2 | |
2 | Round 2 | |
3 | Round 2 |
Example (want):
ID | Round (string) | Randomization | Randomization_Complete |
1 | Round 1 | Group 1 | Group 1 |
2 | Round 1 | Group 2 | Group 2 |
3 | Round 1 | Group 1 | Group 1 |
1 | Round 1.2 | Group 2 | |
2 | Round 1.2 | Group 2 | |
3 | Round 1.2 | Group 1 | |
1 | Round 2 | Group 2 | |
2 | Round 2 | Group 2 | |
3 | Round 2 | Group 1 |
LH
Comment