BookmarkSubscribeRSS Feed
StudentPhil
Calcite | Level 5
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
2 REPLIES 2
data_null__
Jade | Level 19
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]
StudentPhil
Calcite | Level 5
Thank you for the post...I think I need to clarify though. I'm not trying to simulate the spouse ages from scratch based on the requirements. Rather, I have two tables - one with all the simulated males, and one with all the simulated females. Now I need to do a matching within those rules.....hope that makes sense?

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 632 views
  • 0 likes
  • 2 in conversation