BookmarkSubscribeRSS Feed
iressa131
Calcite | Level 5

Hi!

 

How would i test for an association between a variable and just 1 level of another variable? 

I only have the 2x2 table. 

I have the following code for testing between two variables. Thanks for any help!

DATA PBP2;
DO a=1 TO 2;
DO b=1 TO 2;
INPUT count @@;
OUTPUT;
END;
END;
CARDS;
146 54 159 41
;
RUN;
PROC FREQ;
TITLE6 "Output" ;
WEIGHT count;
TABLES a*b /CHISQ;
RUN;
3 REPLIES 3
iressa131
Calcite | Level 5

Hi!

 

How would i test for an association between a variable and just 1 level of another variable? 

I only have the 2x2 table. 

I have the following code for testing between two variables. Thanks for any help!

DATA PBP2;
DO a=1 TO 2;
DO b=1 TO 2;
INPUT count @@;
OUTPUT;
END;
END;
CARDS;146 54 159 41;
RUN;
PROC FREQ;
TITLE6 "Output" ;
WEIGHT count;
TABLES a*b /CHISQ;
RUN;
ballardw
Super User

@iressa131 wrote:

Hi!

 

How would i test for an association between a variable and just 1 level of another variable? 

I only have the 2x2 table. 


I am not sure what you mean by that type of test? What exactly would you be testing for? In your example which level of which variable are you testing against in the other?

 

Note that your code does not run as posted.

The CARDS and DATALINE statements must 1) have the Cards or datalines as the only statement on one line of code and 2) the ; or ;;;; in the case of Cards4 or equivalent must be on a line by itself, not at the end or a row of data.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 914 views
  • 0 likes
  • 3 in conversation