Hi,
Please help me with SAS code for 3 ways contingency table. I want my table to look like below. Any help would be appreciated.
For future reference: When pasting a log file, or an output from a procedure, click on the {i} icon and paste your text into that window.
Try something like this:
proc report data=have;
columns x1 x2 x3;
define x1/group "Label for X1";
define x2/group "Label for X2";
define x3/across "Label for X3";
run;
The basic form of the analysis is:
proc freq data=have;
tables x1*x2*x3;
run;
PROC FREQ has lots of options: https://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=statug&docsetTarget=statug_fr...
Also, PROC REPORT ought to be able to do this.
For future reference: When pasting a log file, or an output from a procedure, click on the {i} icon and paste your text into that window.
Try something like this:
proc report data=have;
columns x1 x2 x3;
define x1/group "Label for X1";
define x2/group "Label for X2";
define x3/across "Label for X3";
run;
You want PROC TABULATE then instead:
proc tabulate data=have;
class def_race victim_race death_penalty;
table def_race="Defandant's Race"*victim_race="Victim's Race" , death_penalty="Death Penalty";
run;
@Kyra wrote:
Hi,
Please help me with SAS code for 3 ways contingency table. I want my table to look like below. Any help would be appreciated.
Thank you very much. This code also worked.
one further question-
Is it possible to do chisq/fisher's for these kind of 3 way contingency tables.
Thanks,
Actually....it can't it does two way tables. Not sure what you would do for a three way table, maybe catmod or proc logistic I suspect.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.