Came across the need to work with collection variables recently with SCCM 2007. This is a feature that is neatly tucked away in the properties of a collection. If you right click on a collection and select 'modify collection settings' we have the option