Say I have a panel data and I wish to see how many individuals moved from occupation "3" to occupation "2". This is easily done with the panel in wide format, how can I achieve this in long format (which is the preferable way to deal with panel in stata as panel estimation models require it). Following is an example code to go from long to wide and calculate this:
The result btw is that 19.1% of the females in the data that had occupation code 3 in the first wave of the panel had occupation code 2 in the last wave of the panel.
Code:
clear all webuse nlswork bysort idcode: gen t = _n keep idcode t occ_code reshape wide occ_code, i(idcode) j(t) tab occ_code1 occ_code13, row
Comment