Psychology 202b

Advanced Psychological Statistics II


SAS programs, 3/1/2011

Here are some SAS programs that were used in class.
  • Our first program demonstrated the use of a simple dummy variable to indicate smoking or non-smoking status.
  • Next, we saw a more complex example where a nine-level categorical variable was coded with a dummy variable for each level. We demonstrated this idea, coding nine different occupations. However, we saw that this produced a redundant set of predictors. Indeed, a collinearity diagnostic showed that the set of predictors was perfectly collinear. That was because, once we know that a person wasn't in one of the first eight groups, we also know that he had to be in the last group (service). Hence, the final dummy variable contains completely redundant information.
  • We saw that dropping the final dummy variable produced the analysis we wanted, which happens to be an ANOVA.
  • We confirmed that this analysis was an ANOVA by comparing it to and ANOVA calculated using the "class" statement in proc glm.
  • We digressed to clarify the book's poor description of Dunnett's test, and demonstrated how to implement Dunnett's test in SAS.
  • Next, we considered models that involved interactions between dummy variables and continuous predictors. We began with a model that examined the effects of smoking status and income on BMI.
  • We saw that there is an advantage to centering the continuous predictor by subtracting its mean from each observation.
  • Finally, we considered a more complex example in which multiple interactions allowed us to have a different regression for each occupation classification.