chi square tests and grouping

I have a set of 130 people which I need to divide into groups of 5 that are proportionate in academic major and gender in comparison to the overall dataset. I have been asked to run chi square analyses to make sure the groups are equally divided. Can anyone give advice as to how to do this?

Bonus points if you can tell me how to enter this into Stata or SPSS :)