I have the following panel data of one individual in the study. WHO stage was recorded multiple times, but I only want to identify the first record of WHO stage, make a new variable for this first WHO stage and copy that stage to all observations of the panel data for the individual. The data looks as follows:
Thanks in advance for all your time and help!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double id byte who_stage float visit_lab_date 829 . . 829 4 20898 829 . . 829 . . 829 . . 829 . 20919 829 . . 829 . . 829 . . 829 . . 829 3 20954 829 . . 829 . . 829 . 21014 829 . . 829 . . 829 . 21133 829 . . 829 . . 829 . . 829 1 21336 829 . . 829 1 21336 829 . . 829 . 21417 829 . 21417 829 . 21417 829 . 21417 829 . 21417 829 1 21427 829 . . 829 . . 829 . 21427 829 . . 829 . . 829 . . 829 . 21623 829 . . 829 1 21623 829 . 21735 829 . . 829 1 21735 829 . . 829 . . 829 1 21882 829 . . 829 1 21882 829 . . 829 . 21910 829 . . 829 . . 829 . 21939 829 . . 829 . 21970 829 . 21999 829 . 21999 829 . 21999 829 . 21999 829 . 21999 829 1 22092 end format %td visit_lab_date
Comment