Efficient estimation with missing values in cross section and panel data