/* 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;
/* PROC TTEST can be used for
(1) One Sample T-tests (not shown here)
(2) Paired T-tests (not shown here)
(3) Two Independent Samples T-tests (THIS TUTORIAL) */
/* Here we want to compare the mean resting pulse between those
who ran and those who sat to see if there are any differences
in these two treatment groups */
PROC TTEST DATA=BIO.PULSE_STEP5;
CLASS TRT; /* Binary Explanatory Variable */
VAR PULSE1; /* Quantitative Response Variable */
RUN;
/* Numeric Summaries of PULSE1 by TRT */
/* We add the CLM option for confidence intervals for the mean in each group */
PROC MEANS DATA = BIO.PULSE_STEP6 N MEAN STD MIN Q1 MEDIAN Q3 MAX CLM;
CLASS TRT;
VAR PULSE1;
RUN;
/* Side-by-side boxplots */
PROC SGPLOT DATA = BIO.PULSE_STEP6;
VBOX PULSE1 / CATEGORY = TRT;
RUN;
/* Let's look at another comparison - mean weight between males and females */
PROC TTEST DATA=BIO.PULSE_STEP5;
CLASS GENDER; /* Binary Explanatory Variable */
VAR WEIGHT; /* Quantitative Response Variable */
RUN;
/* Numeric Summaries of WEIGHT by GENDER */
/* We add the CLM option for confidence intervals for the mean in each group */
PROC MEANS DATA = BIO.PULSE_STEP6 N MEAN STD CLM;
CLASS GENDER;
VAR WEIGHT;
RUN;
PROC MEANS DATA = BIO.PULSE_STEP6 MIN Q1 MEDIAN Q3 MAX;
CLASS GENDER;
VAR WEIGHT;
RUN;
/* Side-by-side boxplots */
PROC SGPLOT DATA = BIO.PULSE_STEP6;
VBOX WEIGHT / CATEGORY = GENDER;
RUN;