<< Click to Display Table of Contents >> Navigation: User guide > Weighting > Grossing up or down using known factors |
To apply a known factor to a subset of the data simply define a variable (usually called $WEIGHT) to hold the relevant value. For example to weight young people ($AGE/1) by a grossing up factor of 1.4:
dw $weight=1.0,
if $age/1, dw $weight=1.4,
select wr $weight,
If there are four age groups and we wish to use a different weighting factor for each group we can put the factors into a table in a Manip Stage and retrieve them later using a table look up definition. Because the table has only one dimension we need a variable with one item for the other dimension.
start control,
c=simple.asc,
cep,
finish control,
start data,
serial number in 1-5,
card characters binary 500,
ds $age=$110/1-4,
xt='Age',
x='Age\Child;Young;Middle aged;Old',
ds $true=t,
xt='Total only',
x='Total',
t #fact(f=nitb/nptb)=$age*$true,
finish data,
start manip,
mt #fact(r1-$,c1-$)=(1.2,1.7,0.65,1.0),
finish manip,
start tables,
dw $weight=$age(#fact),
select wr $weight,
t #1(f=puc/ptp/nunr)=$age*,
finish tables,
The four grossing up factors are placed in a table called #FACT which is "dummy" defined in the data stage. The relevant factor is then extracted from this table in the tables stage and used as the weight. Table 1 is produced to check that the weights have been correctly applied.