Solved
New Contributor
Posts: 3

# code to run correspondence analysis on m*n contingency matrix as input

Hi Team,

I am trying to run correspondence analysis on a m*n contingency matrix, which I am using as input data. I want the plot in 2 dimension. What is the code for it? I tried simple corresponding analysis code, but that requires categorical variables  as input data.

Accepted Solutions
Solution
‎03-27-2018 01:28 PM
Occasional Learner
Posts: 1

## Re: code to run correspondence analysis on m*n contingency matrix as input

I guess you want to see it Brand wise. So, please add Brand in the first column. Then use the code below:

PROC CORRESP DATA=XXX outc=corres_result noprint;
var Var1 - Var40 ;
id BRAND;
run;

ods html file="/home/YYY/corresp/xxx_coords_pct.xls";
proc print data=corres_result;
run;
ods html close;
endsas;

Please edit the code as per your dataset & variable name..

Hope this will help.

All Replies
Super User
Posts: 23,754

## Re: code to run correspondence analysis on m*n contingency matrix as input

If your data is continuous wouldn't you be using Principal components analysis or factor analysis instead?

@_Piyush wrote:

Hi Team,

I am trying to run correspondence analysis on a m*n contingency matrix, which I am using as input data. I want the plot in 2 dimension. What is the code for it? I tried simple corresponding analysis code, but that requires categorical variables  as input data.

Solution
‎03-27-2018 01:28 PM
Occasional Learner
Posts: 1

## Re: code to run correspondence analysis on m*n contingency matrix as input

I guess you want to see it Brand wise. So, please add Brand in the first column. Then use the code below:

PROC CORRESP DATA=XXX outc=corres_result noprint;
var Var1 - Var40 ;
id BRAND;
run;

ods html file="/home/YYY/corresp/xxx_coords_pct.xls";
proc print data=corres_result;
run;
ods html close;
endsas;

Please edit the code as per your dataset & variable name..

Hope this will help.
New Contributor
Posts: 3

## Re: code to run correspondence analysis on m*n contingency matrix as input

[ Edited ]

Thanks Anjanita!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
• 3 replies
• 136 views
• 0 likes
• 3 in conversation