Hi everyone,
I am working with panel data consisting of a survey of respondents(pid) across 3 waves (3, 4, and 5). How can I generate a binary variable that takes the value of 1 if a respondent(pid) appears in all 3 waves and 0 otherwise. Thanks.
I am working with panel data consisting of a survey of respondents(pid) across 3 waves (3, 4, and 5). How can I generate a binary variable that takes the value of 1 if a respondent(pid) appears in all 3 waves and 0 otherwise. Thanks.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long pid float wave 301072 3 302124 3 303433 3 303536 3 304653 3 306632 3 306683 3 306683 4 307009 3 307105 3 307184 3 309889 3 309959 3 310765 3 314107 3 314119 3 314164 3 314873 3 315305 3 315366 3 315413 3 315918 3 315956 3 315979 3 316319 3 316564 3 316566 3 318376 3 318618 3 318635 3 318678 3 318679 3 318927 3 319396 3 319689 3 319941 3 321447 3 321485 3 321777 3 321785 3 322077 3 322526 3 381022 3 401011 3 401011 4 401011 5 401012 3 401013 3 401013 4 401013 5 401014 3 401014 4 401014 5 401015 3 401016 3 401016 4 401016 5 401017 3 401017 4 401017 5 401018 3 401018 4 401018 5 401019 3 401019 4 401019 5 401020 3 401020 4 401020 5 401021 3 401021 4 401021 5 401022 3 401022 4 401022 5 401023 3 401023 4 401023 5 401024 3 401024 4 401024 5 401025 3 401026 3 401026 4 401026 5 401027 3 401027 4 401028 3 401028 4 401028 5 401030 3 401030 4 401030 5 401031 3 401031 4 401031 5 401032 3 401032 4 401032 5 401033 3 end

Comment