You can enter any valid CSPro expression as a universe, weight or value tallied. This includes not only variables, constants, logical operators (and
), and mathematical operators (+, -, *, /, ...) but also CSPro functions (count
, ...). Making full use of these expressions allows you to create complex tables very easily. Here are some examples:
Tabulate only households where at least one child was born last year with the following universe (assuming that CHILDREN_BORN_LAST_YEAR is a variable on the person record):
count(CHILDREN_BORN_LAST_YEAR) > 0
Count only households with "married couple families," i.e. a household with both a head of household and a spouse present, with the following universe:
count(PERSON where RELATIONSHIP = 1) > 0 and count(PERSON where RELATIONSHIP = 2) > 0
Restrict a table to only households with total household income of greater than $20,000 by using the following universe:
sum(PERSONAL_INCOME) > 20000
This assumes that PERSONAL_INCOME is a variable on the person record. The sum of the incomes of each person in the household is the total income for the entire household.
Restrict a table to only households where the head of household is female with the following universe:
This assumes that the head of the household is always the first person record (occurrence 1). This will only be true if your data entry program and/or edit program ensure this. If this is not true, then you would need a more complicated expression such as:
count(PERSON where RELATIONSHIP = 1 and SEX = 2) = 1
This will be true only if there is a person in the household who is the head of household and is female. This assumes that there is only one head of household in the household, which should be the case for properly edited data.
Often fertility information is captured separately for male and female children and you wish to tabulate it for both sexes. For example, you have variables for MALE_CHILDREN_BORN and FEMALE_CHILDREN_BORN but no variable for total children born and you want to count the total number of children born. You can use the sum of the two variables in the value tallied:
MALE_CHILDREN_BORN + FEMALE_CHILDREN_BORN
Note that if one or more of the variables is a special value
, the counts will not be correct. This is because the sum of a special value and a number is a special value.