Way to change direction of risk difference in proc freq, without changing data in SAS

Viewed 22

Suppose I have a dataset called example with variable x and y, where both are binary {0,1}. I want to find the risk difference stratified by a variable strata.

proc freq data = example;
    table strata*x*y / commonriskdiff(CL=NEWCOMBEMR);
run;

enter image description here

However, suppose I want them in different direction, i.e., I want 0.004 (-0.017, 0.028)

I can do

data example2;
    set example;
    y_2 = 1 - y;
run;
proc freq data = example2;
    table strata*x*y_2 / commonriskdiff(CL=NEWCOMBEMR);
run;

but is there a way to do it directly on proc freq, without the extra step of creating example2 dataset?

1 Answers

commonriskdiff(CL=NEWCOMBEMR column = 2)

Related