Hello All,
I have a dataset where I have two variables, id number and ownership structure. ID number is the unique identifier. Each ID number has one corresponding ownership structure. The same ID repeats several times in the dataset, but in certain cases it does not have the corresponding ownership structure. I run the code
but Stata reports either "0 real changes made" or "weights not allowed". I use the command in other cases, sometimes it runs fine. Below, please see my data extraction
I would highly appreciate it if you could advise me on how I can improve my command.
Thank you in advance,
Nick
I have a dataset where I have two variables, id number and ownership structure. ID number is the unique identifier. Each ID number has one corresponding ownership structure. The same ID repeats several times in the dataset, but in certain cases it does not have the corresponding ownership structure. I run the code
Code:
bysort ownershipstructure ( id_n ) : replace ownershipstructure = ownershipstructure [_n-1] if missing( ownershipstructure )
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long id_n str86 ownershipstructure 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "" 1161 "publicly traded" 1161 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1300 "publicly traded" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "" 1327 "publicly traded" 1327 "publicly traded" 1327 "publicly traded" 1327 "publicly traded" 1388 "" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1388 "publicly traded" 1704 "" 1704 "" 1704 "" 1704 "" 1704 "" 1704 "" 1704 "" 1704 "" 1704 "" 1704 "" 1704 "" 1704 "" end
I would highly appreciate it if you could advise me on how I can improve my command.
Thank you in advance,
Nick
Comment