Array


Hi,

I have a 2 year panel data, and I do not have stateside information for 2019. To match the states for both years, I run the following command:

bys id: gen st=state
bys id: replace st=state[_n+1] if year==2019

However, when I run the code, Stata replaces only 2 observations but not all. How can I fix my problem?

Thanks!