weighting cases/ variables in tabulation

Discussions about tools to complement CSPro data processing
Forum rules
New release: CSPro 8.0
Post Reply
Peter
Posts: 3
Joined: April 24th, 2017, 7:40 am

weighting cases/ variables in tabulation

Post by Peter »

Hi - I am new to cspro and not many people use it in South Africa and Sorry but I havnt mastered syntax etc. BUT Is there an easy way to weight variables, say gender for exaple, in tabulation - like in other packages? Females are over represented in my sample. Thanks Peter van Laar
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: weighting cases/ variables in tabulation

Post by Gregory Martin »

In your tabulation application:

1) Click on the "Edit" menu.

2) Select "Tally Attributes Table."

3) There is a Weight area. You can add the name of the variable that is your weight. Or you can add a constant (e.g., 100 if you had a 1% sample).
Peter
Posts: 3
Joined: April 24th, 2017, 7:40 am

Re: weighting cases/ variables in tabulation

Post by Peter »

Thanks very much, I tried that with race as a variable in my case I need to weight Whites at 1.15, Blacks at .95 and iNDIANS AT 1.2. I don't seem able to do that as only 1 weight is allowed?? HELP! Thankyou and reagrds Peter
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: weighting cases/ variables in tabulation

Post by Gregory Martin »

What you typically would do in this case is:

1) Add an item to your dictionary, on the person form, called RACE_WEIGHT.

2) Write a batch application, that would do something like this:
PROC RACE

    if RACE = 1 then
        RACE_WEIGHT = 1.15;

    elseif RACE = 2 then
        RACE_WEIGHT = 0.95;

    // ...

    endif;
3) When running your batch application, you have your input file (your existing data), and your output file will then contain a copy of the input data but with the race weights added.

4) You create your table, with your weight as RACE_WEIGHT, and run it on the output of your batch application, the data file that contains this newly constructed variable.

There are ways to do this directly in your batch application, but they're a bit more complex, so this is probably your best bet.
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: weighting cases/ variables in tabulation

Post by Gregory Martin »

Also, there's a more advanced example in the CSPro examples folder. Look at this folder:

3 - Tabulation\Adding Weights

It uses a lookup file, but it shows the general idea of how to add weights to a data file.
Peter
Posts: 3
Joined: April 24th, 2017, 7:40 am

Re: weighting cases/ variables in tabulation

Post by Peter »

Thanks so much for your kind respose - I will try it
Best Wishes Peter
Post Reply