Dear Statalists,
I have a dataset in the following shape for several counties and years:
County Year Variable
1 1977 .
1 1978 .
1 1979 .
1 1980 3000
1 1981 3000
...
3 1977 .
3 1978 .
3 1979 .
3 1980 4000
3 1981 4000
...
For all counties, the values for the years 1977 to 1979 are missing for "variable" and I want to replace those missings with the value from the year 1980 of the respective county. I could find comments on how to fill in values from the top to the bottom but not vice versa. Does anyone have a suggestion for me? I suppose I will need a loop as I want to replace the values for several counties.
Thank you in advance!
Related Posts with Replace values from bottom to top
empty rows removed when importinghello I am importing the attached txt file. The code I used is: Code: import delimited test.txt,…
First differences and lagged variables in panel dataHello everybody, I'm quite new to Stata and I would like to generate first differences of all my va…
How to differentiate "tabulate", "table", "tabstat", "tabdisp"?I don't know which one should be used in specific cases. Many thanks in advance! …
Is it possible to add multiple recode commands to one newly generated variable?Hello all! I saw a few forums that were somewhat similar to this but did not answer this exact quest…
Panel Data TechniquesHello, I'm running a fixed effect model (after proven by Hausman Test) and I'm not sure if the code …
Subscribe to:
Post Comments (Atom)
0 Response to Replace values from bottom to top
Post a Comment