Hello,
I have a Stata coding question. Below is a made up dataset with only two variables, state and city.
The state variable has missing values. I want to carry forward the values so that it looks like this.
I tried using the mipolate package that I found from this entry. I noticed that to use this package, I need a group id variable and a variable to index each group. Unfortunately, my dataset only has two variables. I don't want to manually fill in the state variable. Does anyone have a more efficient solution?
https://www.statalist.org/forums/for...-interpolation
I have a Stata coding question. Below is a made up dataset with only two variables, state and city.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str10 state str13 city "california" "san diego" "" "san francisco" "" "santa rosa" "" "los angeles" "texas" "houston" "" "dallas" "" "austin" "new york" "rochester" "" "albany" end
The state variable has missing values. I want to carry forward the values so that it looks like this.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str10 state str13 city "california" "san diego" "california" "san francisco" "california" "santa rosa" "california" "los angeles" "texas" "houston" "texas" "dallas" "texas" "austin" "new york" "rochester" "new york" "albany" end
I tried using the mipolate package that I found from this entry. I noticed that to use this package, I need a group id variable and a variable to index each group. Unfortunately, my dataset only has two variables. I don't want to manually fill in the state variable. Does anyone have a more efficient solution?
https://www.statalist.org/forums/for...-interpolation

Comment