BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jhs2171
Obsidian | Level 7

Hi 

I posted a question eariler today about different statistical methods to examine relationship between binary/nominal variables in my dataset. Someone suggested correspondence analysis and here's the SAS code I used. 

 

data tab1;
input sleep_place$1-12 co_sleep$13-16 onback ontummy onside;
datalines;
SafePlace No 17 26 6
SafePlace Yes 1 2 1
UnsafePlace No 14 10 4
UnSafePlace Yes 44 27 20
;


data tab2;set tab1;
length newvar $ 28;
newvar=cat(sleep_place,co_sleep);run;

 

ods graphics on;
proc corresp data=tab2 plot;
var onback ontummy onside;
id newvar;run;
ods graphics off;

 

My question is: Does it make sense to have one combined ID variable?  Also, is there anything I should add/delete/change? 

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

That choice of ID variable doesn't seem to be helpful. Try combining them, like this:

 

data tab1;
length ID $16;
input sleep_place $1-12 co_sleep  $13-16 onback ontummy onside;
ID = catc(sleep_place,co_sleep);
datalines;
SafePlace   No  17 26 6
SafePlace   Yes 1 2 1
UnsafePlace No  14 10 4
UnSafePlace Yes 44 27 20
;

proc corresp data=tab1;
var onback ontummy onside;
id ID;
run;

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

That choice of ID variable doesn't seem to be helpful. Try combining them, like this:

 

data tab1;
length ID $16;
input sleep_place $1-12 co_sleep  $13-16 onback ontummy onside;
ID = catc(sleep_place,co_sleep);
datalines;
SafePlace   No  17 26 6
SafePlace   Yes 1 2 1
UnsafePlace No  14 10 4
UnSafePlace Yes 44 27 20
;

proc corresp data=tab1;
var onback ontummy onside;
id ID;
run;
jhs2171
Obsidian | Level 7

Hi Rick, 

 

Thank you for your comment! After I posted my question, I realized it didn't really make sense to use only one of the variables as ID, so I combined the first two and made the change to my original posting! I just tried what you suggested, and it returned the same result so thank you for the confirmation!! You been super helpful today! 

 

 

 

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 ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1552 views
  • 3 likes
  • 2 in conversation