## Attempting to simulate population based on census profile

Occasional Contributor
Posts: 7

# Attempting to simulate population based on census profile

Hello,

I'm trying to use census (aggregated) data to simulate the population for a city (~800,000 people). The desired end result is to have a separate record for each individual with their simulated gender, age, and family structure. I've managed to do the gender and age bit, but running into complex issues trying to do the family structure bit.

As a simple example, I know from the census that, in a small defined area, there are 'm' married couples. I have simulated their ages, and now I want to assign spouses. So I've randomly selected, for example, 'm' males aged 18 and over to represent my married men. Now, from the females, I need to randomly select appropriate matching spouses. By appropriate, I mean that I need to do according to the following distributions:

- 50% of the female spouses are either the same age as the male or up to a maximum of 5 years younger
- 26% of the female spouses are older than their male spouses, by a maximum of 10 years (higher probability to be closer in age than farther)
- 24% of the female spouses are between five and twelve years younger than the male, with, again, to keep it simple, a simple inverse linear relationship (i.e. higher probability to be closer in age than farther; though simplest would be to just use a uniform distribution, which is also okay - will just be stated in "assumptions")
- The overall mean age difference is 2.5 years (older males)

Any thoughts, suggestions, code, solutions....anything at all would be much appreciated. I'm sure this will just keep getting complicated, but one step at a time!

Many thanks
Posts: 3,852

## Re: Attempting to simulate population based on census profile

Could you use the RANTBL function to pick a spouse group for each married male?. Using that info and overall age diff create and age for the wife.

[pre]
311 data _null_;
312 do maleAge = 18 to 30;
313 spouseGroup = rantbl(12345,.5,.26);
314 put (_all_)(=);
315 end;
316 run;

maleAge=18 spouseGroup=1
maleAge=19 spouseGroup=2
maleAge=20 spouseGroup=3
maleAge=21 spouseGroup=1
maleAge=22 spouseGroup=1
maleAge=23 spouseGroup=2
maleAge=24 spouseGroup=1
maleAge=25 spouseGroup=2
maleAge=26 spouseGroup=2
maleAge=27 spouseGroup=3
maleAge=28 spouseGroup=1
maleAge=29 spouseGroup=1
maleAge=30 spouseGroup=1
[/pre]
Occasional Contributor
Posts: 7