Hello,

I´m stucked with my data cleaning. Below, a excerpt of my dataset is shown. I only have included data from one gvkey code, but in total there are approx. 7500 unique gvkey codes in my dataset.

As you can see below, I only have some values for my co_per_rol and becameceo variable. In case of missing values, I want to have the same values like for the observations with nonmissing values.

I tried to solve this problem by using total command, however this does not work if I have more than 1 nonmissing values for the observations.

Thanks in advance!

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input long gvkey int fyearqtr_ec long co_per_rol int becameceo
1045 217     .     .
1045 223     .     .
1045 220     .     .
1045 221     .     .
1045 222     .     .
1045 227     .     .
1045 224 49256 19701
1045 225     .     .
1045 226     .     .
1045 231     .     .
1045 228     .     .
1045 229     .     .
1045 230     .     .
1045 235     .     .
1045 232 49256 19701
1045 233     .     .
1045 234     .     .
1045 236     .     .
1045 237     .     .
1045 238     .     .
1045 243     .     .
1045 240     .     .
1045 241     .     .
1045 242     .     .
1045 247     .     .
1045 244     .     .
1045 245     .     .
1045 246     .     .
end
format %tq fyearqtr_ec
format %td becameceo