What are the two factors which determine why somebodies in solar system have atmosphere and others don't have?

The ability of a body (planet) to hold the atmosphere depends on (i) acceleration due to gravity, and (ii) surface temperature.