Why are the mass ratios of O to KClO3 and O2 to KClO3 the same?

I just did a lab that involved heating KClO3 (with MnO2 as a catalyst) to decompose it into KCl and oxygen gas. That part is easy. What's throwing me is the % yield calculations.

The theoretical yield of O should just be the mass percentage of O in KClO3 (48.00/122.55 = KClO3 is 39.17% O by mass).

The actual yield of O2 (measured by subtraction) was 0.840 g out of a initial mass of 2.062 g KClO3, or 40.7%.

My question is this: Given that the theoretical yield was 39.17% based on moles of O (not O2) , why is the actual yield 40.7% (well with margins of error outlined by the professor) when it's based on O2? Shouldn't it be half as much? Or did I mess my calculations up?

Please feel free to edit tags, I'm out of my depth on this particular SE site in that area.

Your calculations are correct. The key is that you are measuring percentage by mass: the mass of oxygen in 2.062 g of $\mathrm{K}\mathrm{Cl}\mathrm{O}_3$ is the same whether it is considered the mass of individual oxygen atoms or of $\mathrm{O}_2$ (or of any other allotrope of oxygen, for that matter). You have half as many moles of $\mathrm{O}_2$, but the mass is the same (since the mass of 1 mol $\mathrm{O}_2$ is twice the mass of 1 mol O).