Hi everyone

I need a general code to fill the remaining cells at "cvcie0" for the same "gvkey" and for the same "fyear" with the same value.
E.g.: Every row with the gvkey: 1001 and the fyear: 2011 should have the value 73 in the column "cvcie0".
I calculated the value 73 but it will drop after dropping duplicates and I believe the value will not drop if every row has the value.

In my data example, I lose the value in the columns "cvcie0" when dropping duplicates and using the code:
__
quietly by gvkey fyear: gen dup = cond(_N==1,0,_n)
drop if dup>1

__

I hope this data example is fine. As I work with credential data, I needed to build a lil dataset.
And I hope I have used dataex the right way.

Thank you so much!
Best,
Jana

----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input int(gvkey fyear) byte(cvcie1 cvcie0)
1001 2011 55  .
1001 2011  . 73
1001 2011  . 73
1001 2011  . 73
1001 2011  . 73
1001 2011  . 73
1001 2011 55  .
1001 2011 55  .
1001 2011  . 73
1001 2012 64  .
1001 2012 64  .
1001 2012  . 23
1001 2012  . 23
1002 2011 12  .
1002 2011 12  .
1002 2011  . 15
1002 2011  . 15
end
------------------ copy up to and including the previous line ------------------

Listed 17 out of 17 observations