Hello,
I have a dataset that looks like this:
I want to generate three new variables that contain the first, second, and third (from left to right) non-missing values in a row, such that my resulting dataset looks like this:
If anyone knows how I can do this, it would be much appreciated!
I have a dataset that looks like this:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(mom_id m_79_last_school m_80_last_school m_81_last_school m_82_last_school m_83_last_school m_84_last_school m_85_last_school) 1 6726 . . . . . . 2 5630 . . . . . . 3 6575 7244 . . 8156 . . 4 . . . . . . . 5 . . . . . . . 6 . . . . 8156 . 8979 7 . . . . 8187 . . 8 5965 . . . . . . 9 . . . 7791 . . . end format %td m_79_last_school format %td m_80_last_school format %td m_81_last_school format %td m_82_last_school format %td m_83_last_school format %td m_84_last_school format %td m_85_last_school
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(mom_id m_79_last_school m_80_last_school m_81_last_school m_82_last_school m_83_last_school m_84_last_school m_85_last_school first second third) 1 6726 . . . . . . 6726 . . 2 5630 . . . . . . 5630 . . 3 6575 7244 . . 8156 . . 6575 7244 8156 4 . . . . . . . . . . 5 . . . . . . . . . . 6 . . . . 8156 . 8979 8156 8979 . 7 . . . . 8156 . . 8156 . . 8 5965 . . . . . . 5965 . . 9 . . . 7791 . . . 7791 . . end format %td m_79_last_school format %td m_80_last_school format %td m_81_last_school format %td m_82_last_school format %td m_83_last_school format %td m_84_last_school format %td m_85_last_school format %td first format %td second format %td third
Comment