weighting cases/ variables in tabulation
weighting cases/ variables in tabulation
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
-
- Posts: 1812
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: weighting cases/ variables in tabulation
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).
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).
Re: weighting cases/ variables in tabulation
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
-
- Posts: 1812
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: weighting cases/ variables in tabulation
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:
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.
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.if RACE = 1 then
RACE_WEIGHT = 1.15;
elseif RACE = 2 then
RACE_WEIGHT = 0.95;
// ...
endif;
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.
-
- Posts: 1812
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: weighting cases/ variables in tabulation
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.
3 - Tabulation\Adding Weights
It uses a lookup file, but it shows the general idea of how to add weights to a data file.
Re: weighting cases/ variables in tabulation
Thanks so much for your kind respose - I will try it
Best Wishes Peter
Best Wishes Peter