BookmarkSubscribeRSS Feed
L_L
Calcite | Level 5 L_L
Calcite | Level 5
Dear all,

I would like to add in a contingency table (created by proc tabulate) the corrispondence p-value: is it possible?
Anyway, how can I do it?

Thanks in advance
Regards
6 REPLIES 6
Paige
Quartz | Level 8
I don't think PROC TABULATE will do this.

I believe you have to create the table in PROC FREQ and use the CHISQ option.
L_L
Calcite | Level 5 L_L
Calcite | Level 5
Ok. The PROC FREQ output (with the chi square option) is
1) contingency table
2) Chi square test
I would like to have in the contingency table the p-value, for example:
Group1 Group2 Group3 *
Male xxx xxx xxx
xx% xx% xx%
Female xxx xxx xxx
xx% xx% xx%
*p=x.xxx

Any ideas?
thx
Paige
Quartz | Level 8
It shouldn't be hard.

proc freq data=whatever;
table gender*group/chisq;
run;
L_L
Calcite | Level 5 L_L
Calcite | Level 5
Thank you. Unfortunaley it's not exactly what I mean.
The aim is to improve the output and to have all the information in one table.
Maybe I have to use a PUT on a file and a PRINTTO...
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello L&L,

Is this what you need?
[pre]
ODS output CHISQ=Chi (keep=Statistic Prob where=(Statistic="Chi-Square"));
proc freq data=SASHELP.CLASS;
table sex*age/out=freq chisq;
run;
proc transpose data=freq out=r(drop=_:) prefix=Age_;
var percent;
id age;
by sex;
run;
data r;
length Sex $10;
set r CHI(in=c rename=(Statistic=Sex Prob=Age_11));
if c then Sex="p-value";
run;
[/pre]
Sincerely,
SPR Message was edited by: SPR
L_L
Calcite | Level 5 L_L
Calcite | Level 5
Yes!! Thank you so much :-))

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 4657 views
  • 0 likes
  • 3 in conversation