The more I use stata, the more I understand that I don't understand explicit subscripting if it contains variables.
For example, the following code is very simple: it would generate the first difference (between adjacent, not necessarily consecutive times), for each person, in ln_wage:
However, I sometime see code such as:
And I don't understand what it's supposed to even do. The help file for subscripting doesn't contain any examples or explanations for something like this. Any guidance or explanation would be extremely helpful.
For example, the following code is very simple: it would generate the first difference (between adjacent, not necessarily consecutive times), for each person, in ln_wage:
Code:
webuse nlswork, clear bysort idcode: gen d_lnwage = ln_wage[_n] - ln_wage[_n-1]
Code:
by serial: replace famunt2=famunit[HHhead]
Comment