BookmarkSubscribeRSS Feed
ZachiD
Calcite | Level 5

Hi,

 

I trying to find an association of specific combinations of values in a very large contingency table.  I'm using proc freq with the option cellchi2. I don't want to scan the result table with my eyes in order to find all the cells with a relative high cellchi values which also have high frequencies. The out option does not output the cellchi data.

So I thought of creating a program that will submit a seperate proc freq for each value.
I've already created a program (see below) that uses macro for issolating a specific value and consoliate all the other and then conduct  a chi-square test for it. The question is how to a create an automatic loop that will do this for a series of values?


%LET celltype = '4';

data cell;
set tinc;
cell_type='Other';
where class=&class and &sc_filter;
if &type=&celltype then cell_type=&celltype;
run;

proc freq data=cell;
table cell_type * site / chisq norow nopercent exact out=freqout;
weight count_number ;
run;

 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Add this into your PROC FREQ

 

ods output crosstabfreqs=crosstabfreqs;

 

By the way, you say you are using CELLCHI2 but your code is not using CELLCHI2.

--
Paige Miller
ZachiD
Calcite | Level 5

I didn't share the main proc freq. I shared the code that produces a chi-square test to a specific value. i.e. conducting manually a cell-Chi-square test.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 364 views
  • 0 likes
  • 2 in conversation