Carey: Psyc 7291: Multivariate Statistics

Examples of SAS Code

Notes:

(1) The downloadable files contain SAS code for performing various multivariate analyses. The code is documented to illustrate the options for the procedures.

(2) Some of the code was written before the point-and-click routines in SAS were developed (e.g., the ANALYST routine). In some cases, you can accomplish the same task much easier by using the point-and-click interface.

(3) All the files are .sas files. In some cases, the raw data are included in the .sas files. Otherwise, they are available as a SAS data set (.sas7bdat format). When the SAS data set is processed, then the column "SAS Data Set" is annotated. Otherwise, this column is blank. Note that in some cases you must set the appropriate LIBNAME statement for your computer to be able to process the SAS data set.

(4) To download, right click on the SAS code (and, if necessary, on the SAS data set) and select "Save Target As" or "Save Link As."

(5) If a SAS data set is specified, then right-click on that link and select "Save Target As" or "Save Link As" to download. Yout can also download the SAS data sets and related documentation using the Data Sets web page.

 

SAS Code Example SAS Data Set Description
     
ANOVA Logic Three_Stooges Computing ANOVA using means and variances
ANOVA Coding   ANOVA coding of a categorical variable
ANOVA: Random effects 1   Nested, random effects in ANOVA using GLM (Hierarchical Linear Models)
ANOVA: Random Effects 2   Nested, random effects in ANOVA using GLM (Hierarchical Linear Models)
Canonical Discriminant Analysis 1 Wolves Diccriminant analysis predicting the sex and the location (Arctic vs. Rocky Mountains) of wolf skull measurements
Canonical Discriminant Analysis 2 WU Twins Canonical discriminant analysis predicting a disgonsis of schizophreni from the MMPI
Cluster Analysis 1 Wolves Cluster analysis of wolf skull measurement data
Cluster Analysis 2 Crime Cluster analysis of crime data
Cluster Analysis 3   Cluster analysis of mammals teeth data
Cluster Analysis 4   Example from the SAS Manual on PROC CLUSTER (mammals teeth data)
Confirmatory Factor Analysis Nat. Merit Twins Confirmatory factor analysis of the subtests of the National Merit Scholarship Qualifying Exam
Confirmatory Factor Analysis WISC Data Confirmatory factor analysis of Tabachnick & Fidell's WISC data set.
Confirmatory Factor Analysis Nat. Merit Twins Using CFA to find the number of factors.
Confirmatory Factor Analysis WISC Data Using CFA to find the number of factors.
Discriminant Analysis 1   Classic discriminant analysis
Discrinimant Analysis 2   Discriminant analysis of Fisher's Iris data (from SAS Manual)
Factor Analysis 1 Nat. Merit Twins Introduction to factor analysis
Factor Analysis 2   Factor analysis (Hathaway & McKinley MMPI data)
Factor Analysis 3   Illustration how different rotation methods gives same predicted correlation matrix
     
GLIM Detroit Example of generalized linear models (GLIM)
Log Linear Analysis 1   Demonstration of Log Linear Analysis and Multiple Regression
Log Linear Analysis 2   Log Linear Analysis (Tabachmick & Fidell Reading Preferences data)
Log Linear Analysis 3   Log Linear models and logistic regression (Robins & Regier ASP data)
Log Linear Analysis 4   Log linear analysis (Tabachnick & Fidell Intimacy data)
Logic of ANOVA 1 Three_Stooges Computing ANOVA using means and variances
Logic of ANOVA 2   ANOVA coding of a categorical variable
Logistic Regression 1 WU Twins Logistic regression for a binary and an ordinal response variable
Logistic Regression 2 WU Twins Comparison of logistic regression, multiple regression, and MANOVA profile analysis
Logistic Regression 3   Comparison of logistic regression, classic discriminant analysis, and canonical discrinimant analysis
MANOVA 1   Intro to MANOVA (Example from SAS Manual)
MANOVA 2   Intro to MANOVA (Shorthand training data from Tatsuoka)
MANOVA & Profile Analysis Three_Stooges Example of a profile analysis
MANOVA & Profile Analysis   (1) How to interpret MANOVA and Profile Analysis, and (2) Differences between univiariate ANOVAs and MANOVA. (See comments in the program)
MANOVA & Profile Analysis   Example of a profile analysis (WAIS data on senile and nonsenile elderly)
Manova & Profile Analysis Genotype Example of a profile analysis (WAIS data on senile and nonsenile elderly)
MANOVA & Profile Analysis Wolves MANOVA & Profile Analysis with twoway ANOVA
MANOVA vs. RM Wolves Compares MANOVA and Repeated Measures
Maximum Likelihood 1   Example of maximum likelihood theory (See Handout on Maximum Likelihood)
Maximum Likelihood 2   Example of maximum likelihood theory (See Handout on Maximum Likelihood)
Mixed Models   Random effects and repeated measures using PROC MIXED
Mixed Models   Repeated measures using PROC MIXED (noise sensitivity data)
Multiple Regression 1   Introduction to multiple regression.
Multiple Regression 2   Multicollinearity and influence statistics (from SAS Manual)
Multiple Regression 3   Detecting an outlier
Multiple Regression 4 Interest Multivariate multiple regression (path analysis using PROC REG)
Multiple Regression 5   Illustrates the normal equations vis matrix algebra
Plot Means Genotype Plot the means for the genotype data set
Plot Means Koro Plot the means for the koro data
Plot Means Wolves SAS code that plots the mean values for the different groups in the wolves data.
     
Plot Means   SAS code that plots the mean values for the different groups in the Alzheiners data set.
Polynomial Regression Detroit Effect of different coding schemes on polynomial regression
Repeated Measures 1   Intro to repeated measures using PROC GLM
Repeated Measures 3   Into to RM and an old homework assignment
Repeated Measures 3   Another old homework assignment for repeated measures
RM: Complicated Design   One between-subjects factor (dose of drug) and three within-subjects factors (recall vs. recognition, names vs. objects, and common vs. rare) in patients with Alzheimer's disease.
RM: Sphericity Test   Sphericity tests in repeated measures ANOVA
SEM Introduction Detroit Introduction to Path Analysis and SEM (Structural Equation Modeling)
SEM 1 Interest Introduction to Path Analysis and SEM using PROC CALIS
SEM 2 Nat. Merit Twins Structural equation model of National Merit test and family demographics
SEM 2 Carolyn Abel Example of imposing an equality constraint
SEM on Latent Variables   SEM model testing the relationship among trauma, attachment, and three different outcome variables.
SEM on Latent Variables National Merit Twins SEM 2 but with latent variables.