SAS Procedures

Help using Base SAS procedures
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 498 views
  • 0 likes
  • 2 in conversation