You assume a 100 g sample and the masses are then numerically the same as the percentages.
Are you talking about empirical formula calculations where you have to convert the percentages to masses?
For example a compound may contain 50.05 % sulfur and 49.95 % oxygen by mass.
You first have to convert these percentages to masses.
You should assume a total mass of exactly 100 g.
In mathematics a percentage is a decimal fraction.
##Decimal Fraction = %/100##
So 40.05 % = 0.4005 and 49.95 % = 0.4995
To get the mass you multiply the total mass by the decimal fraction.
Mass of S = 0.4005 100 g = 40.05 g.
Mass of O = 0.4995 100 g = 49.95 g
If you use conversion factors in your chemical calculations you can write
##Mass of S = cancel(100 g sample) 40.05 g S/cancel(100 g sample) = 40.05 g S##
##Mass of O = cancel(100 g sample) 49.95 g O/cancel(100 g sample) = 49.95 g O##
Either method is quite acceptable. Use the one that you prefer.