user3625618
user3625618

Reputation: 111

Weight in Proc TABULATE Has No Effect

I have a table of frequencies that I'm feeding into a Proc Tabulate step. The data come with a weight variable, and I want to include the weighted results in the generated table. Whether I use the weight variable in the VAR or the WEIGHT option, it has no effect on the output table. I've also tried using the weight variable in the TABLE statements for the analysis variables, but again, no effect.


PROC FORMAT; PICTURE PCTF (ROUND) OTHER='009.9%'; RUN;
ODS HTML PATH="%SYSFUNC(GETOPTION(WORK) )" STYLE=JOURNAL1A;

PROC TABULATE DATA = CHSS2017_s1 f=10.2 S=[just=c cellwidth=75]; 

CLASS AGE SEX Q21;

CLASSLEV AGE      / style=[font_weight=medium];
CLASSLEV SEX      / style=[font_weight=medium];
CLASSLEV Q21;

WEIGHT REGIONWT ;
*VAR REGIONWT ;

TABLE ALL     = 'Greater Cincinnati Residents' * (ROWPCTN=' '*f=PCTF.)
      AGE     = 'Age'            * (ROWPCTN='   '*f=PCTF.)
      SEX                        * (ROWPCTN='   '*f=PCTF.)
      , Q21;

RUN;

The expected result should be a proc tabulate output with values that reflect the weight variable, 'REGIONWT'

Upvotes: 0

Views: 577

Answers (1)

Quentin
Quentin

Reputation: 6378

From my reading of the docs, in PROC TABULATE the WEIGHT statement specifies weights for analysis variables, i.e. variables listed on a VAR statement.

You don't have any analysis variables, you only have class variables.

You might want to look into the FREQ statement as it will impact counts and %, but note that it will treat all the weights as integers.

Upvotes: 2

Related Questions