turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Chi square

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-10-2011 07:56 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-10-2011 07:57 AM

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.

I believe you have to create the table in PROC FREQ and use the CHISQ option.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-10-2011 08:42 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-10-2011 11:14 AM

It shouldn't be hard.

proc freq data=whatever;

table gender*group/chisq;

run;

proc freq data=whatever;

table gender*group/chisq;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-10-2011 01:18 PM

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...

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...

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-10-2011 02:19 PM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-10-2011 04:23 PM

Yes!! Thank you so much :-))