group macro uses select macro to generate sql