- SAS - Dates & Times
- SAS - Macros
- SAS - Input Methods
- SAS - Functions
- SAS - Decision Making
- SAS - Loops
- SAS - Operators
- SAS - Numeric Formats
- SAS - Arrays
- SAS - Strings
- SAS - Variables
- SAS - Data Sets
- SAS - Basic Syntax
- SAS - Program Structure
- SAS - User Interface
- SAS - Environment
- SAS - Overview
- SAS - Home
SAS Data Set Operations
- SAS - Simulations
- SAS - Output Delivery System
- SAS - SQL
- SAS - Format Data Sets
- SAS - Sort Data Sets
- SAS - Subsetting Data Sets
- SAS - Merging Data Sets
- SAS - Concatenate Data Sets
- SAS - Write Data Sets
- SAS - Read Raw Data
SAS Data Representation
SAS Basic Statistical Procedure
- SAS - Hypothesis Testing
- SAS - One-Way Anova
- SAS - Repeated Measure Analysis
- SAS - Fishers Exact Tests
- SAS - Chi-Square
- SAS - Bland-Altman Analysis
- SAS - Linear Regression
- SAS - Correlation Analysis
- SAS - T Tests
- SAS - Cross Tabulations
- SAS - Frequency Distributions
- SAS - Standard Deviation
- SAS - Arithmetic Mean
SAS Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SAS - Correlation Analysis
Correlation analysis deals with relationships among variables. The correlation coefficient is a measure of pnear association between two variables.Values of the correlation coefficient are always between -1 and +1. SAS provides the procedure PROC CORR to find the correlation coefficients between a pair of variables in a dataset.
Syntax
The basic syntax for applying PROC CORR in SAS is −
PROC CORR DATA = dataset options; VAR variable;
Following is the description of the parameters used −
Dataset is the name of the dataset.
Options is the additional option with procedure pke plotting a matrix etc.
Variable is the variable name of the dataset used in finding the correlation.
Example
Correlation coefficients between a pair of variables available in a dataset can be obtained by use their names in the VAR statement.In the below example we use the dataset CARS1 and get the result showing the correlation coefficients between horsepower and weight.
PROC SQL; create table CARS1 as SELECT invoice, horsepower, length, weight FROM SASHELP.CARS WHERE make in ( Audi , BMW ) ; RUN; proc corr data = cars1 ; VAR horsepower weight ; BY make; run;
When the above code is executed, we get the following result −
Correlation Between All Variables
Correlation coefficients between all the variables available in a dataset can be obtained by simply applying the procedure with the dataset name.
Example
In the below example we use the dataset CARS1 and get the result showing the correlation coefficients between each pair of the variables.
proc corr data = cars1 ; run;
When the above code is executed, we get the following result −
Correlation Matrix
We can obtain a scatterplot matrix between the variables by choosing the option to plot matrix in the PROC statement.
Example
In below example we get the matrix between horsepower and weight.
proc corr data = cars1 plots = matrix ; VAR horsepower weight ; run;
When the above code is executed, we get the following result −
Advertisements