Hi all,
I'm currently working a dataset in which some of the values of the variable are missing. I'm unable to share the data, therefore, I'm giving an example below for a context. For example, as you can see that IDs are recorded repeatedly with visits but values are missing for IDs. How can I fill those missing values according to each ID once a value of Visit is created. In other words, (example below) I want to fill all missing values of ID (1)= 10. And for all ID (4) = 20 , for all ID (6) = 20 and so on. Please note that there are only two values for Visit variable. I would be very grateful if anybody could help me with a particular code on this problem. Please let me know if you need further clarification. Thank you so much.
Variables:
ID: Visit:
1 10
1 10
1
2 10
2
2
3
4 20
4
4
4
5 10
5
6
6
6 20
6
6
I'm currently working a dataset in which some of the values of the variable are missing. I'm unable to share the data, therefore, I'm giving an example below for a context. For example, as you can see that IDs are recorded repeatedly with visits but values are missing for IDs. How can I fill those missing values according to each ID once a value of Visit is created. In other words, (example below) I want to fill all missing values of ID (1)= 10. And for all ID (4) = 20 , for all ID (6) = 20 and so on. Please note that there are only two values for Visit variable. I would be very grateful if anybody could help me with a particular code on this problem. Please let me know if you need further clarification. Thank you so much.
Variables:
ID: Visit:
1 10
1 10
1
2 10
2
2
3
4 20
4
4
4
5 10
5
6
6
6 20
6
6
Comment