Hi guys,
I am trying to calculate a fertility ratio out of a census by group of age. The two main variables I need that are actually found in the census are women from 15 to 49 yrs old and children from 0 to 5 yrs old.
If I take the Child-Women Ratio (CWR) of the population, I just divide the number of children from 0 to 5 yrs old / women from 15 to 49 yrs old = CWR.
But the problem comes when I want to calculate that ratio by group of age (15-19 ; 20-24 ; 25-34; 35-44 ; 45 +). So I need to 'link' children to their mother. I just don't know how to manipulate the data.
There are not actual calculus here, but only data manipulation so I can after it, select the Frequency function and show the occurence.
Another variable I have in the dataset is also the 'relation to the head', which tells me the relation of the individual to the father (so I look for son, daughter and spouse of the same family) and I also have a variable called 'family unit' which indicate thanks to a family number to which family the mother and the children belong.
I cannot just filter the women by group age and then divided by the number of children from 0 to 5. I need to get the children which are associated to the women of the group age. Well, this is how I understand it.
Here is an example I made up on Excel to help visualize what I mean.
Is anyone has any idea how to make that work ?
Your help would be a lifesaver !
Cheers
Answer by jkpeck (6143) | Oct 05 at 01:42 PM
Real family data is likely to be more complicated - grandchildren, subfamilies, missing female parent, kids not children of female parent etc, but this code should get reasonably close.
* choose female head or spouse and sons or daughters.
select if (gender eq "F" and relation eq "Head" or relation eq "Spouse") or relation eq "Son" or relation eq "Daughter".
* calculate family size.
aggregate
/outfile=* mode=addvariables
/break=FamilyNum
/familySize=n.
* select female parent (hoping there is only one such).
select if relation eq "Head" or relation eq "Spouse".
* reduce count by the parent, group ages, and tabulate.
compute numkids = familySize - 1.
compute agegroup = trunc(age/5).
ctables /table agegroup by numkids[S].
I just binned the ages by 5 year intervals. For a more sophisticated grouping, use Transform > Visual Binning.
SPSS Syntax - DO IF Else logic: Computing variable "if any three variables equal...." 1 Answer
Splitting a string variable divided by comma's into new single variables 2 Answers
Compute one variable that represents 2 variables. (UMBRELLA VARIABLE) 0 Answers
Create a new variable based on date 0 Answers
Recoding variables with SPSS Syntax 0 Answers