<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: correlation of specific variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/correlation-of-specific-variables/m-p/667886#M200097</link>
    <description>&lt;P&gt;Depends a bit on your exact data layout but sounds like you want some BY group processing. Equivalent example with SASHELP.HEART which is the Framingham Heart study.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, it's looking for correlation between diastolic and systolic pressure for each type of cholesterol status.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.heart out=heart;
by chol_status;
run;

proc corr data=heart;
by chol_status;
var diastolic systolic;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your data is not in the correct structure, you can restructure it with PROC TRANSPOSE.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jul 2020 22:10:18 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-07-08T22:10:18Z</dc:date>
    <item>
      <title>correlation of specific variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/correlation-of-specific-variables/m-p/667885#M200096</link>
      <description>&lt;P&gt;I'm working with biological data and have a large number of concentrations for the same biochemical from two tissue types. I want to examine the correlation between the two tissue types for the same biochemical, i.e, chemical 1 from liver with chemical 1 from blood; chemical 2 from liver with chemical 2 from blood, etc. I don't want any of the other correlations. Is there a simple way to do this? The number of biochemical can range from 60 to over 300. I don't want to have to run Proc Corr 250 times if I can avoid it. The number of patients ranges from 10 to 30. I don't have a lot of experience with DO loops or macros in SAS, but I have a little.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 22:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/correlation-of-specific-variables/m-p/667885#M200096</guid>
      <dc:creator>mdwilson</dc:creator>
      <dc:date>2020-07-08T22:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: correlation of specific variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/correlation-of-specific-variables/m-p/667886#M200097</link>
      <description>&lt;P&gt;Depends a bit on your exact data layout but sounds like you want some BY group processing. Equivalent example with SASHELP.HEART which is the Framingham Heart study.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, it's looking for correlation between diastolic and systolic pressure for each type of cholesterol status.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.heart out=heart;
by chol_status;
run;

proc corr data=heart;
by chol_status;
var diastolic systolic;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your data is not in the correct structure, you can restructure it with PROC TRANSPOSE.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 22:10:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/correlation-of-specific-variables/m-p/667886#M200097</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-08T22:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: correlation of specific variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/correlation-of-specific-variables/m-p/667888#M200098</link>
      <description>&lt;P&gt;Place some of the variables on the VAR statement and others on a WITH statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the documentation&lt;/P&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV id="procstat.corr.corrwith" class="aa-section"&gt;
&lt;PRE class="xis-codeBlock"&gt;proc corr;
   var x1 x2;
   with y1 y2 y3;
run;
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will calculate correlations of X1 with y1, y2 and y3 plus X2 with y1, y2 and y3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may end up with some results you don't actually want but those should be easy to ignore. Or use a couple of Proc Corr calls if there are way too many to deal with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your data should be structured so that each variable represents chem1Blood and chem1Liver for that approach.&lt;/P&gt;
&lt;P&gt;OR possibly a one record per chemical and measurements at blood and liver. That would use a BY variable of chemical. Something like the following where "blood" is the variable with the blood measurement and "liver" is the variable with the liver measurement.&lt;/P&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV id="procstat.corr.corrwith" class="aa-section"&gt;
&lt;PRE class="xis-codeBlock"&gt;proc corr;&lt;BR /&gt;   by chemical;
   var blood;
   with liver;
run;
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not clear on the role&amp;nbsp; of "patient" here as I would not expect to have lots of repeated values for a single patient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 22:18:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/correlation-of-specific-variables/m-p/667888#M200098</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-08T22:18:45Z</dc:date>
    </item>
  </channel>
</rss>

