Can we use a reshape command to reshape (wide to long) a small part of a data with a large number of variables without dropping other variables?
-
Login or Register
- Log in with
* Example generated by -dataex-. For more info, type help dataex clear input float(id inc2020 inc2021 other) 101 1 2 42 102 2 1 666 103 0 0 2001 end reshape long inc, i(id) j(year) list, sepby(id) noobs
. list, sepby(id) noobs +--------------------------+ | id year inc other | |--------------------------| | 101 2020 1 42 | | 101 2021 2 42 | |--------------------------| | 102 2020 2 666 | | 102 2021 1 666 | |--------------------------| | 103 2020 0 2001 | | 103 2021 0 2001 | +--------------------------+
Comment