I assume that this has bee asked before but my search has not come up with a answer therefore I will ask it.
Why do some patterns give the amount of yarn needed in grams rather that yards/meters?
While searching I found this appropriate statement by Knitasha:
Originally Posted by knitasha

Grams are a measure of weight.
Yards are a measure of length.
Apples and oranges.

If the pattern is using a yarn the for the number of WrapsPerInch (WPI) does not weight much 50 grams of yarn may have 300 yards of yarn. A second ball of yarn with the same WPI but comes from a variety of sheep that has heavier wool may only have 250 yards for 50 grams.
Doesn't a pattern that calls for 50 grams of "X" yarn do a disservice to a knitter you may not like "X" yarn and wants to use another type? Especially, for a new knitter that does not have a lot of money or experience substituting yarns.