Dear Community.

I have about five million observations(men, age 40s).

I'd like to classify these 5 million people into 10 groups (randomly) according to the distribution below.
In other words, each observation should be allocated from group 1 to 10, but should be matched overall proportion of the group.

group proportion
1 0.07
2 0.19
3 0.16
4 0.12
5 0.21
6 0.01
7 0.05
8 0.04
9 0.1
10 0.05
(total 1.00)


In addition, I have an overall observation of about 20 million people, and the above tasks should be performed by gender*age groups.


Thanks in advance.


Best regards,
Yunsun