/* The dataset has the formats below permanently assigned to certain variables. We do NOT need to rerun the DATA step used to assign the formats however we DO need to resubmit the PROC FORMAT so SAS will know the translations used */ PROC FORMAT; VALUE GDR 1 = "Male" 2 = "Female"; VALUE YN 1 = "Yes" 2 = "No"; VALUE EXER 1 = "High" 2 = "Moderate" 3 = "Low"; VALUE TREAT 1 = "Ran" 2 = "Sat"; VALUE BMI_TWO 1 = "< 25" 2 = "25+"; VALUE BMI_FOUR 1 = "< 18.5" 2 = "[18.5, 25)" 3 = "[25, 30)" 4 = "30+"; VALUE WT_TWO 1 = "87kg or Below" 2 = "More than 87kg"; VALUE WT_FOUR 1 = "55kg or Below " 2 = "(55kg, 60kg]" 3 = "(60kg, 67kg]" 4 = "(67kg, 79kg]" 5 = "More than 79kg"; RUN; /* We remove an unusual observation that is likely an error, We create a binary and multi-level version of weight, and label and format these new variables */ DATA BIO.PULSE_STEP5; SET BIO.PULSE_STEP4; /* Remove observation with likely error - very high resting pulse */ IF PULSE1 > 140 THEN DELETE; /* BINARY WEIGHT */ IF 0 <= WEIGHT <= 87 THEN BinaryWT = 1; IF 87< WEIGHT <= 120 THEN BinaryWT = 2; /* Multi-level WEIGHT */ IF 0 < WEIGHT <= 55 THEN WTGroups = 1; IF 55 < WEIGHT <= 60 THEN WTGroups = 2; IF 60 < WEIGHT <= 67 THEN WTGroups = 3; IF 67 < WEIGHT <= 79 THEN WTGroups = 4; IF 79 < WEIGHT <= 120 THEN WTGroups = 5; LABEL BinaryWT = "Binary Weight" WTGroups = "Weight Categories"; FORMAT BinaryWT WT_TWO. WTGroups WT_FOUR.; RUN; /* We add three options to our use of PROC FREQ, CHISQ and FISHER to obtain p-values for tests and EXPECTED to obtain the expected cell counts. Remember that we use a * between variables, multiple requests can be placed in one TABLES statement and variables can be grouped in parentheses. The variables to the left of the * are the rows and those to the right, the columns */ PROC FREQ DATA=BIO.PULSE_STEP5; TABLES TRT*(GENDER SMOKES ALCOHOL EXERCISE) / CHISQ FISHER EXPECTED; RUN; PROC FREQ DATA=BIO.PULSE_STEP5; TABLES GENDER*(BinaryWT WTGroups) / CHISQ FISHER EXPECTED; RUN;