If glass is made of sand (i.e. silica) which is usually yellow, why is most glass green or blue?

The yellow color in the sand and the green color in the glass are both due to iron compounds. But in the sand, you are seeing the color (orangish) that the iron reflects, while in the glass you see the color that it transmits.

High-purity silica is highly transparent, and is used for fiber optics for that reason. However, very slight levels of impurity will absorb some of the light. The part of the spectrum absorbed by the impurity determines the color of the glass – if red light is absorbed, the glass looks blue, for example.