You asked specifically about compounding so I'll tell you - in the US you use the apothecary system in which an oz is 31.1Gm (in a practical sense it is 31Gm)
However...if you are a pharmacy student, you will eventually need to understand the relationship between avoirdupois & apothecary weight. The avoirdupois system is used by pharmacists to buy & sell medications OTHER THAN on prescription.
The apothecary system is used to dispense & compound prescriptions.
Check in Remington's for a good history & summary of how & why the two weights came into being. The Imperial system (British - perhaps Canadian....don't know???) is based on its own system which I think is strictly avoirdupois, but I can't be sure on this.
The USP adopted our standards in 1890 & they were reaffirmed in 1944.
So...for compounding - use apothecary (31.1G if you're in school....30G if you're not for 1oz).