0
votes

I just recently realized that when you use proc tabulate in SAS, if you're working with categorical variable, WEIGHT does not work! Is there anyway of getting around that?

Explanation: spouse, child, parent are binary variables (1 for living with and 0 for not living with)

Here is my code:

PROC TABULATE
DATA=censusrounds;

    CLASS spouse;
    CLASS parent;
    CLASS SEX;
    CLASS AGEGROUP;
    CLASS child;
    CLASS sample;

    TABLE sample*SEX*AGEGROUP,
        RowPctN*(spouse parent child);
    ;
    WEIGHT PERWT;

RUN;
1
Looks like you might be using IPUMS data. Are you sure you need to use PERWT as a weighting factor and not as the analysis variable itself? IPUMS docs suggest the latter. PERWT is a pre-weighted count of people.Craig Srsen

1 Answers

0
votes

I think you need to add PerWt as a var in order to call it with the weight option. I mocked up your data below and tried it a few different ways.

data censusrounds;
infile datalines delimiter=',';
input spouse child parent sex agegroup $ sample rowpctN perwt;
datalines;
1, 0, 0, 0, a, 5, .6, .20
0, 1, 0, 0, a, 5, .5, .30
0, 0, 1, 0, a, 5, .4, .25
1, 0, 0, 1, a, 5, .3, .10
0, 1, 0, 1, a, 5, .2, .15
;
run;
PROC tabulate
DATA=censusrounds;

CLASS spouse parent SEX AGEGROUP child sample;
var rowpctN perwt;

TABLE sample*SEX*AGEGROUP,
    RowPctN*(spouse parent child);
;
WEIGHT PERWT;

RUN;