Dear all,
I have the following data set in long format where individuals are repeatedly measured both in baseline and in followup as shown in the variable 'pre'. The variable 'dayno' refers to the first day at both occasion. 'dcount' refers the number of measurements on each day. As can be seen that the number of measurements are not same on first day for both occasions.
Problem:
- My question is how can I insert two rows that are short in baseline compared to the followup.
Other information:
- 'Dayno' varies from 1-6
- In other 'id' it could be a reversal situation, i.e 'dcount' higher in baseline and lower in follow up.
-Naturally the new rows will create missing values which is not of concern.
Your help is highly appreciated and many thanks in advance.
Regards,
I have the following data set in long format where individuals are repeatedly measured both in baseline and in followup as shown in the variable 'pre'. The variable 'dayno' refers to the first day at both occasion. 'dcount' refers the number of measurements on each day. As can be seen that the number of measurements are not same on first day for both occasions.
Problem:
- My question is how can I insert two rows that are short in baseline compared to the followup.
Other information:
- 'Dayno' varies from 1-6
- In other 'id' it could be a reversal situation, i.e 'dcount' higher in baseline and lower in follow up.
-Naturally the new rows will create missing values which is not of concern.
Code:
+--------------------------------------------+ | id pre dayno dcount outcome | |--------------------------------------------| 1. | 1 Baseline 1 4 3.571429 | 2. | 1 Baseline 1 4 4.571429 | 3. | 1 Baseline 1 4 2.857143 | 4. | 1 Baseline 1 4 3.857143 | |--------------------------------------------| 5. | 1 Follow up 1 6 6 | 6. | 1 Follow up 1 6 6 | 7. | 1 Follow up 1 6 5.714286 | 8. | 1 Follow up 1 6 5.714286 | 9. | 1 Follow up 1 6 5.857143 | 10. | 1 Follow up 1 6 6 | |--------------------------------------------| 11. | 1 Baseline 2 8 5 | 12. | 1 Baseline 2 8 4.571429 | 13. | 1 Baseline 2 8 5.857143 | 14. | 1 Baseline 2 8 4.571429 | 15. | 1 Baseline 2 8 4.571429 | 16. | 1 Baseline 2 8 4.857143 | 17. | 1 Baseline 2 8 5.285714 | 18. | 1 Baseline 2 8 3 | |--------------------------------------------| 19. | 1 Follow up 2 7 6 | 20. | 1 Follow up 2 7 6.285714 | 21. | 1 Follow up 2 7 5.571429 | 22. | 1 Follow up 2 7 6.142857 | 23. | 1 Follow up 2 7 6 | 24. | 1 Follow up 2 7 5.714286 | 25. | 1 Follow up 2 7 6 | +--------------------------------------------+
Regards,
Comment