1
votes

I have data with

  • One binary variable, poor
  • Two socio-demographic variables var1 and var2

I would like to have the poverty rate of each of my var1 * var2 possible value, that would look like that :

enter image description here

But with three variables in a proc freq, I get multiple outputs, one for each value of the first variable I put on my product

proc freq data=test;
table var1*var2*poor;
run;

How can I get something close to what I would like ?

1
Check out PROC TABULATE. Do you want just the frequency counts or percentages as well?Quentin
I would rather have the pourcentages only. I want to know the poverty rate in each of my var1 * var2 valueAnthony Martin

1 Answers

1
votes

Try this

    data test;
    input var1 var2 poor;
    cards;

    1 1 1
    2 3 0
    3 2 1
    4 1 1
    1 2 1
    2 3 0
    4 1 0
    4 2 0
    3 1 1
    1 2 0
    3 2 0
    1 3 1
    3 3 0
    3 3 0
    3 3 1
    1 1 0
    2 2 0
    2 2 1
    2 2 1
    2 1 1
    2 1 1
    2 1 1

    ;
run;


proc tabulate data=test;
class var1 var2 poor;
tables var1,
       var2*poor*pctn<poor>={label="%"};
run;