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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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