SAS PDS: CONTINGENCY TABLE



Contingency Table AssignmentMake a two-dimensional contingency table from the two dichotomous variables in your personal data set. You may, if you wish, convert one of your continuous variables into a dichotomous variable and use it. In this case you will recode one continuous variable by assigning all values below the median to category 1 and all at or above the median to category 2. For example, Chris has 4 variables: GENDER, RACE, WEIGHT, and HEIGHT. He will recode HEIGHT, which has a median of 67. He has 42 subjects. If he recodes all heights 66 to a 1 and all those 67 to a 2, he will have an approximately even split, 20 in 1 and 22 in 2. Here is how he will do it: In his data step, he will enter the following SAS STATEMENTS:IF 0 < HEIGHT LE 66 THEN HEIGHT2 = 1;ELSE IF HEIGHT > 66 THEN HEIGHT2 = 2;PROC FREQ is then used to construct the contingency table. The SAS statements are:PROC FREQ; TABLES GENDERHEIGHT2;Please run the program If_Then.sas from my SAS programs page. Look carefully at the program and the output to learn how to avoid having missing data converted into spurious data. SAS represents, internally, missing data with a numeric value that is extreme and negative. If I had written “IF HEIGHT LE 66 THEN HEIGHT2 = 1” any cases with missing data on height would be assigned a score of “1” on height2.If you have imported your data from an SPSS or Excel file you will not be in a data step after the export. You will have to create a data step to be able to recode variables. For example, suppose that during the importation you gave your data the name “blorq.” To copy these data into a new data step you could command: data glurb; set blorq; -- you would then have your data in a new data step and could execute the IF/THEN statements.Copy and paste your table into a Word document. Name that document “Nnnn_ContingencyTable,” where “Nnnn” is your last name. If the identity of the variables and their values are not clear from the SAS produced table, edit the table to make them clear. Then type in an explanation of who or what your subjects were, how you obtained the data, and what the two dichotomous variables were. Then present a brief summary statement in which you describe the relationship found. Be sure to include in your statement the appropriate conditional probabilities as well as an appropriate odds ratio. Assume that the data you have represent the entire population in which you are interested.Here is an example of such a contingency table, with only the cell and marginal counts, calculating the relevant conditional probabilities by hand:Glasses?GenderYesNoMale101323P(Glasses = Yes | Gender = Male) = 10/23 = .4348Female31417P(Glasses = Yes | Gender = Female) = 3/17 = .1765132740Thus, wearing glasses is positively correlated with being male (more likely in men than in women).The conditional odds of wearing glasses given the person is a man are 10/13. For women it is 3/14. The odds ratio is 10/13/(3/14) = 3.59. That is, the odds of wearing glasses are 3.59 times higher for men than for women.Here are some examples from previous students who did rather well on this assignment:Racial profiling at Raleigh Durham Airport.Walking the dogs at Walltop Kennels. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download