

{"id":12179,"date":"2018-03-29T10:18:41","date_gmt":"2018-03-29T04:48:41","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=12179"},"modified":"2021-05-09T13:16:31","modified_gmt":"2021-05-09T07:46:31","slug":"sas-correlation-analysis","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/","title":{"rendered":"SAS Correlation Analysis &#8211; Understand the PROC CORR &amp; Correlation Matrix"},"content":{"rendered":"<p>In our previous SAS tutorial, we learned about<strong> SAS scatter plot<\/strong>, now we will be looking at an interesting statistical procedure, SAS correlation analysis. We will be learning different aspects of SAS correlation\u00a0analysis:<\/p>\n<ul>\n<li>Correlation analysis creation between two variables<\/li>\n<li>Correlation analysis creation between all variables and SAS scatter plot<\/li>\n<li>SAS Correlation matrix of the relationship between variables<\/li>\n<li>SAS PROC CORR Procedure<\/li>\n<\/ul>\n<p>So, let&#8217;s start with SAS Correlation Analysis tutorial.<\/p>\n<h2>SAS Correlation Analysis<\/h2>\n<p>Correlation analysis in SAS is a method of statistical evaluation used to study the strength of a relationship between two, numerically measured, continuous variables (e.g. height and weight).<\/p>\n<p>SAS Correlation analysis is a particular type of\u00a0analysis, useful when a researcher wants to establish if there are possible connections between variables.<\/p>\n<p>In other words, it&#8217;s a measure of how things are related. The correlation coefficient is a measure of linear association between two <strong>variables in SAS<\/strong>. Values of the correlation coefficient are always between -1 and +1.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Correlation.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12183 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Correlation.jpg\" alt=\"Association or relationship between two variables. Co-relate? r. relation. X. Y. Covary---Go together.\" width=\"960\" height=\"720\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Correlation.jpg 960w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Correlation-150x113.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Correlation-300x225.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Correlation-768x576.jpg 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/p>\n<h3>SAS PROC CORR Procedure<\/h3>\n<p>The SAS PROC CORR procedure produces Pearson correlation coefficients of continuous numeric variables.<\/p>\n<p><strong>SAS PROC CORR\u00a0Syntax-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">PROC CORR DATA=dataset &lt;options&gt;;\r\n\u00a0\u00a0\u00a0 VAR variable(s);\r\nRUN;<\/pre>\n<p>The VAR statement is where you specify all of the variables you want to compute pairwise correlations for. You can list as many variables as you want, with each variable separated by a space.<\/p>\n<h3>SAS Correlation of all Variables<\/h3>\n<p>Below we will use Fisher&#8217;s iris data\u00a0from\u00a0SAS help. To compute the SAS correlation analysis of all variables we only use one PROC CORR statement without VAR. this displays correlation among all the variables in the dataset.<\/p>\n<p><strong>Example-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">proc corr data=sashelp.iris;\r\nrun;<\/pre>\n<p>The iris dataset has four variables and the output displays correlation between these four variables.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corr-of-all-variables.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12184 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corr-of-all-variables.png\" alt=\"SAS Correlation of all Variables\" width=\"474\" height=\"247\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corr-of-all-variables.png 474w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corr-of-all-variables-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corr-of-all-variables-300x156.png 300w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<h3>SAS Correlation between Two Variables<\/h3>\n<p>In this example we will use sample data, we will use two variables: \u201cHeight\u201d and \u201cWeight\u201d and show a correlation between these two.<\/p>\n<p><strong>Example-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">PROC CORR DATA=sample;\r\n\u00a0\u00a0 VAR weight height;\r\nRUN;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corre-two-variable-output-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12185 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corre-two-variable-output-1.png\" alt=\"SAS Correlation Between Two Variables\" width=\"487\" height=\"118\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corre-two-variable-output-1.png 487w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corre-two-variable-output-1-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corre-two-variable-output-1-300x73.png 300w\" sizes=\"auto, (max-width: 487px) 100vw, 487px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corr-two-variables-output-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12186 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corr-two-variables-output-2.png\" alt=\"SAS Correlation Analysis Between Two Variables\" width=\"241\" height=\"237\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corr-two-variables-output-2.png 241w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/corr-two-variables-output-2-150x148.png 150w\" sizes=\"auto, (max-width: 241px) 100vw, 241px\" \/><\/a><\/p>\n<p>The above table contains the Pearson correlation coefficients and test results.<\/p>\n<h3>SAS Correlation Matrix<\/h3>\n<p>The relation between two variables and their correlation can also be expressed in the form of a scatter plot or a scatter plot matrix.<\/p>\n<ul>\n<li><strong>PLOTS=MATRIX(options)<\/strong><br \/>\nCreate a scatter plot matrix of the variables in the VAR statements.<\/li>\n<li><strong>PLOTS=SCATTER(options)<\/strong><br \/>\nCreate individual scatter plots of the variables in the VAR statements.<\/li>\n<\/ul>\n<p>Let us again consider the iris data from SAS help and present a scatter plot matrix of all variables.<\/p>\n<p><strong>Example-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">proc corr data=sashelp.iris plots=matrix(histogram);\r\nrun;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/scatterplot-matrix.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12187 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/scatterplot-matrix.png\" alt=\"SAS Correlation Analysis - SAS Correlation Matrix\" width=\"640\" height=\"640\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/scatterplot-matrix.png 640w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/scatterplot-matrix-150x150.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/scatterplot-matrix-300x300.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/scatterplot-matrix-100x100.png 100w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>This was all in SAS Correlation Analysis Tutorial.<\/p>\n<h2>Summary<\/h2>\n<p>We understood what is a SAS correlation analysis, how can we perform a correlation analysis in SAS Programming Language on all the variables, correlation analysis of two variables, correlated data in the form of a scatter plot or a scatter plot matrix and SAS PROC CORR example with the procedure.<\/p>\n<p>If you have any queries, feel free to ask in the comment section.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our previous SAS tutorial, we learned about SAS scatter plot, now we will be looking at an interesting statistical procedure, SAS correlation analysis. We will be learning different aspects of SAS correlation\u00a0analysis: Correlation&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":12182,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[3002,10006,11970,11971,11972,12139],"class_list":["post-12179","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sas","tag-correlation-analysis-in-sas","tag-proc-corr-example","tag-sas-correlation","tag-sas-correlation-analysis","tag-sas-correlation-matrix","tag-sas-proc-corr"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SAS Correlation Analysis - Understand the PROC CORR &amp; Correlation Matrix - DataFlair<\/title>\n<meta name=\"description\" content=\"SAS Correlation Analysis tutorial covers SAS PROC CORR procedure, SAS Correlation of all Variables &amp; between Two Variables and SAS Correlation Matrix.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SAS Correlation Analysis - Understand the PROC CORR &amp; Correlation Matrix - DataFlair\" \/>\n<meta property=\"og:description\" content=\"SAS Correlation Analysis tutorial covers SAS PROC CORR procedure, SAS Correlation of all Variables &amp; between Two Variables and SAS Correlation Matrix.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-29T04:48:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-09T07:46:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-correlation-analysis-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SAS Correlation Analysis - Understand the PROC CORR &amp; Correlation Matrix - DataFlair","description":"SAS Correlation Analysis tutorial covers SAS PROC CORR procedure, SAS Correlation of all Variables & between Two Variables and SAS Correlation Matrix.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/","og_locale":"en_US","og_type":"article","og_title":"SAS Correlation Analysis - Understand the PROC CORR &amp; Correlation Matrix - DataFlair","og_description":"SAS Correlation Analysis tutorial covers SAS PROC CORR procedure, SAS Correlation of all Variables & between Two Variables and SAS Correlation Matrix.","og_url":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-03-29T04:48:41+00:00","article_modified_time":"2021-05-09T07:46:31+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-correlation-analysis-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"SAS Correlation Analysis &#8211; Understand the PROC CORR &amp; Correlation Matrix","datePublished":"2018-03-29T04:48:41+00:00","dateModified":"2021-05-09T07:46:31+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/"},"wordCount":477,"commentCount":2,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-correlation-analysis-01.jpg","keywords":["Correlation Analysis in SAS","PROC CORR Example","SAS Correlation","SAS Correlation Analysis","SAS Correlation Matrix","SAS PROC CORR"],"articleSection":["SAS Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/","url":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/","name":"SAS Correlation Analysis - Understand the PROC CORR &amp; Correlation Matrix - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-correlation-analysis-01.jpg","datePublished":"2018-03-29T04:48:41+00:00","dateModified":"2021-05-09T07:46:31+00:00","description":"SAS Correlation Analysis tutorial covers SAS PROC CORR procedure, SAS Correlation of all Variables & between Two Variables and SAS Correlation Matrix.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-correlation-analysis-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-correlation-analysis-01.jpg","width":1200,"height":628,"caption":"SAS Correlation Analysis"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/sas-correlation-analysis\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"SAS Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/sas\/"},{"@type":"ListItem","position":3,"name":"SAS Correlation Analysis &#8211; Understand the PROC CORR &amp; Correlation Matrix"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/12179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=12179"}],"version-history":[{"count":8,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/12179\/revisions"}],"predecessor-version":[{"id":93358,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/12179\/revisions\/93358"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/12182"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=12179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=12179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=12179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}