The compound will be 57.5% Na, 40.0% O and 2.5% H by mass.
Here's how to do a "percent by mass" problem:
First, unless some other quantity is stated, start by assuming you have one mole of the compound. In this case, that is 40.0 g of NaOH.
Next, read the formula to determine the number of moles of each type of atom in the compound. One mole of NaOH contains one mole of Na, one mole of O and one mole of H.
Look up the molar mass of each element:
Na = 23.0 g/mol
O = 16.0 g/mol
H = 1.0 g/mol
Now, divide each atomic mass by the molar mass of the compound, then multiply by 100 to change the resulting decimal into a percentage: