In a panel data I have two variables among many, one is ID (some industry codes) and other has value like financing. Some of the codes have missing values. Like codes D1 to D20 has values then D21 to D23 don't. How do I replace those missing values with some of those which are there, like D3 value to be copied for D21 and D15 for D22? So no pattern or sequencial replacing, random manual matching. Any easy code?
I tried this:
replace financing = financing[rownumber of D3] if code == "D21"
and it seems to be working. My issue is if there's any way to get it linked with variable and observation rather than row number since row number would keep changing with editing of data.
I tried this:
replace financing = financing[rownumber of D3] if code == "D21"
and it seems to be working. My issue is if there's any way to get it linked with variable and observation rather than row number since row number would keep changing with editing of data.
Comment