If the reaction you are considering is:
Mg + 1/2O2 → MgO
The mass of Magnesium metal is the mass from the weighing balance measured at the start of the experiment
Theoretical yield of MgO can be determined based on the reaction stoichiometry. i.e. 1 mole of Mg yields 1 mole of MgO. therefore, from the known moles of Mg (= mass of mg/atomic mass of Mg) the # moles of MgO produced can be calculated.
% yield = (experimental/theoretical)*100