Target weighting

<< Click to Display Table of Contents >>

Navigation:  User guide > Weighting >

Target weighting

This is similar to grossing up except that the factors are not known. The wanted targets (weighted totals) are known. The procedure here is to accumulate a table of actual figures and then the targets can be divided by the actuals to produce the weighting factors. The relevant factor can then be extracted and used to weight tables.

The three tables involved (actuals, targets and factors) must be the same size and are usually all defined in the data stage. Where two or more variables are involved the last variable only is used as the columns. If there are three or more variables use a matrix definition (.BY.) to combine all but the last to make the row variable. To extract the relevant cell use a matrix definition (.BY.) to combine the rows and the columns into one variable.

IMPORTANT: all variables for weighting must be single valued for the simple reason that each respondent can only have one weight at any one time.

Here is an example of target weighting using three variables with percentage targets:

start control,

* Target weight example (targ1.stp)

c=targs.cba,

cep,h,y,

finish control,

start data,

serial number in 6-8,

card numbers 1,2, in column 1,

order 1234567890XV,

!

! This example applies target weighting based

! upon the three variables age, sex and class.

!

! First pick up all variables needed

! for the target weighting

!

ds $sex=$109/1,2,

xt='Sex of respondent', 

x='Sex\Male;Female', 

ds $age=$110/1,2,3,

xt='Age of respondent', 

x='Age\Young;middle;old', 

ds $class=$111/1,2,

xt='Social class of respondent', 

x='Social class\ABC1;C2DE', 

!

if $sex/b+$age/b+$class/b,

el 'Faulty float variables', 

!

! The main bulk of the variable

! definitions would be here

!

! ...

!

! Now we increment the table of actuals

! and set up the other tables needed for

! the weighting using NITB.

!

ds $tarsid=$sex.by.$age,

ds $tartop=$class,

t #tarac(f=nptb/dbl)=$tarsid*$tartop,

t #tarta(f=nptb/nitb/dbl)=$tarsid*$tartop,

t #tarwt(f=nptb/nitb/dbl)=$tarsid*$tartop,

!

finish data,

start manip,

!

! Set the targets.

! In this example the targets are percentages.

! Each row of targets is for the two classes.

!

mt #tarta(r1-$,c1-$)=(10, 6, ! $sex/1.$age/1

9, 7, ! $sex/1.$age/2 

11, 8.4,! $sex/1.$age/3 

10, 6.6,! $sex/2.$age/1 

8, 5, ! $sex/2.$age/2 

10, 9), ! $sex/2.$age/3 

!

! Calculate the weight factors leaving

! the total unchanged.

! Because the targets would weight to 100

! we need to adjust the figures back to

! the total.

!

dw $tota=%tsum(#tarac(r1-$,c1-$)),

dw $tott=%tsum(#tarta(r1-$,c1-$)),

mt #tarwt=#tarta/#tarac*$tota/$tott,

!

finish manip,

start tables,

!

! Get the weighting factor from the table

!

ds $tarext=$sex.by.$age.by.$class,

dw $weight=$tarext(#tarwt),

select wr $weight,

!

! It is good practice to produce

! weighted tables to check that the

! weighting has been applied correctly

!

f=puc/dpt1,

t #w1b=*$sex,

vt='Weight check males/females',

if $sex/1, +t #w1(f=nrtv/rtt)=$age*$class,

if $sex/2, +t #w2(f=nrtv/rtt)=$age*$class,

f=npuc/dpt0,

!

! The main tables for the run would be here

!

! ...

!

finish tables,