21
Introduction To Correlation with SAS Sam Gordji [email protected] Weir 107

Introduction To Correlation with SAS Sam Gordji [email protected] Weir 107

Embed Size (px)

Citation preview

Page 1: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Introduction To Correlation with SAS

Sam Gordji

[email protected]

Weir 107

Page 2: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

List of Statistical Packages Available through OIT

• SPSS (Windows)• SAS (Windows & Unix)• Mathematica (Windows)• Matlab (willow, Unix)• Free PGI Fortran compiler

Page 3: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

General Information

• IT staff will assist users – To access these packages– To find the proper procedure to analyze

their data

• For assistance please email– [email protected]

Page 4: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Correlation with SAS

• This seminar covers correlation with SAS • SAS is available in

– Weir Student Lab (4 PCs)– Weir 107– Several other labs around campus

• SAS is also installed on willow (Unix server)• SAS performs statistical analysis including

procedure correlation

Page 5: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Statistical Package:SAS/PC (cont.)

• 50 copies are available for faculty use• For each copy purchased, a faculty

member can get a free copy (to be installed on a student PC)

• The cost is $200 per copy per year (starting Aug. 2009)

• To obtain a copy of SAS please email – [email protected]

Page 6: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Installation of SAS

• To obtain a DVD for SAS send an email to:– [email protected]

• The instruction for installation will be emailed to you

Page 7: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Links for SAS

• The main webpagehttp://www.sas.com/

• For information on documentation for SAS visit

http://support.sas.com/onlinedoc/913/docMainpage.jsp

• SAS Resources for Faculty and Students:

http://www.mcsr.olemiss.edu/mathematica/fall_sem/SASResources.ppt

Page 8: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

SAS’ Three Main Files

• *.sas (a SAS program file created by the user, an input file)

• *.log (a file created by SAS containing the “log” after the user’s program is finished running)

• *.lst (a file containing the output)• Examples of the three SAS files

– my.sas – my.log– my.lst

Page 9: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Running SAS on Windows

Click on the “SAS” icon to activate SAS Create your program (below) in a window named “Editor- Untiled1”

Blue Text is your program/* comments go between slashes and stars */

data test; /* every SAS program starts with “data” , test is a given name for this program */

input a b c; /* variables are a, b, and c */ cards; /* input data will follow “cards” */1 2 3 /* variable a has 2 observations, 1 and 2 */2 3 -1 /*variable b has 2 observations, 2 and 3, and so on */; /* semicolon signals the end of the data */proc print; proc means;

/* proc print prints the data, proc means obtains several statistics

including the mean */run; /* run, runs the program */

Page 10: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Running SAS on WindowsUser’s SAS Program

Click “run” and then “submit” the above example

Page 11: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Running SAS on Windows listing file (output of SAS)

Input data:

Results:

Page 12: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Running SAS on WindowsSAS log file

first 3 lines of the user’s input

Lines 6 & 7 end data & proc print

Lines 7 & 8 proc means & run

Page 13: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Correlation

• Correlation coefficient measures the relationship between two variables

• The correlation coefficient is always between -1 and 1, -1.0<=C<=1.0

• Values near 0 are indication of no relationship and values near 1 indicate a strong relationship between the variables

• Negative values indicate negative relationship

Page 14: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

An Example of Correlation corr748re.sas

• Below is an example of correlation analysis• Data is entered into “Editor”• Download corr748re.sas program below from: http://www.mcsr.olemiss.edu/educationsubpage.php?

pagename=jancamp09_inc

Page 15: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Output from Correlation Analysis

Page 16: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Non-parametric Correlation

• Proc corr also performs non-parametric correlation

• Proc corr below performs non-parametric correlation and obtains Spearman, Kendall Tau, and Hoeffding correlation

Page 17: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Non-parametric Correlation

Page 18: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Non-parametric CorrelationAssumes That the Input Data Is Non-Parametric

Pearson

Spearman

Kendall Tau

Page 19: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Some SAS Proc • Proc (Procedure)

– proc means (obtains mean, standard deviation)

– proc anova (performs simple AOV)– proc plot (plots) – proc lp (performs Linear Programming)– proc reg ( performs regression)– proc corr (performs correlation)

Page 20: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

Questions

• Email contact– Email your questions to [email protected]

• To look at this presentation and other materials visit, Computing Camp at www.mcsr.olemiss.edu

• Please fill out the feedback form and leave your email address so we may contact you for follow up questions

Page 21: Introduction To Correlation with SAS Sam Gordji ccsam@olemiss.edu Weir 107

For Further Practice

• Go to

– http://www.mcsr.olemiss.edu/educationsubpage.php?pagename=jancamp09_sam.inc

download and run the following examples

– mort1.sas – mem_corr.sas