<?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 Partial Correlation in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Partial-Correlation/m-p/514211#M2683</link>
    <description>&lt;P&gt;I&amp;nbsp;have the following data, including mean, std and correlation matrix:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;data test (type=corr);&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;input _type_$ _name_$ x1 x2 x3 x4 x5 x6 x7 x8;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;datalines;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;n . 176 176 176 176 176 176 176 176&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;mean . 608.65 59.09 0.8075 0.8553 40.75 7.697 94.55 42.56&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;std . 114.95 38.64 0.3776 0.3554 24.87 2.710 44.48 34.09&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr SP 1.0000 0.8383 0.6149 0.6837 0.7106 0.6891 0.6722 0.7046&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr EFB_POST 0.8383 1.0000 0.5739 0.7181 0.7893 0.7597 0.6851 0.9299&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr SPR 0.6149 0.5739 1.0000 0.6899 0.5478 0.5055 0.4975 0.5639 &lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr EFR 0.6837 0.7181 0.6899 1.0000 0.7120 0.7109 0.6172 0.6934&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr ECFA 0.7106 0.7893 0.5478 0.7120 1.0000 0.8105 0.7704 0.7546&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr HGC 0.6891 0.7597 0.5055 0.7109 0.8105 1.0000 0.7318 0.7413&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr NLT 0.6722 0.6851 0.4975 0.6172 0.7704 0.7318 1.0000 0.6736&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr EFB_PRE 0.7046 0.9299 0.5639 0.6934 0.7546 0.7413 0.6736 1.0000&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;run;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried with the following command to find out the partial correlation, but the result doesn't look right to me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;proc&amp;nbsp;proc corr data = test;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;var x1 x2 &lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;partial x3 x4;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;run;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did I make any mistake there?&amp;nbsp; I am just looking for a better way other than using iml. Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Sun, 18 Nov 2018 09:56:45 GMT</pubDate>
    <dc:creator>kakahingwong</dc:creator>
    <dc:date>2018-11-18T09:56:45Z</dc:date>
    <item>
      <title>Partial Correlation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Partial-Correlation/m-p/514211#M2683</link>
      <description>&lt;P&gt;I&amp;nbsp;have the following data, including mean, std and correlation matrix:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;data test (type=corr);&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;input _type_$ _name_$ x1 x2 x3 x4 x5 x6 x7 x8;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;datalines;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;n . 176 176 176 176 176 176 176 176&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;mean . 608.65 59.09 0.8075 0.8553 40.75 7.697 94.55 42.56&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;std . 114.95 38.64 0.3776 0.3554 24.87 2.710 44.48 34.09&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr SP 1.0000 0.8383 0.6149 0.6837 0.7106 0.6891 0.6722 0.7046&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr EFB_POST 0.8383 1.0000 0.5739 0.7181 0.7893 0.7597 0.6851 0.9299&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr SPR 0.6149 0.5739 1.0000 0.6899 0.5478 0.5055 0.4975 0.5639 &lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr EFR 0.6837 0.7181 0.6899 1.0000 0.7120 0.7109 0.6172 0.6934&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr ECFA 0.7106 0.7893 0.5478 0.7120 1.0000 0.8105 0.7704 0.7546&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr HGC 0.6891 0.7597 0.5055 0.7109 0.8105 1.0000 0.7318 0.7413&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr NLT 0.6722 0.6851 0.4975 0.6172 0.7704 0.7318 1.0000 0.6736&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;corr EFB_PRE 0.7046 0.9299 0.5639 0.6934 0.7546 0.7413 0.6736 1.0000&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;run;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried with the following command to find out the partial correlation, but the result doesn't look right to me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;proc&amp;nbsp;proc corr data = test;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;var x1 x2 &lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;partial x3 x4;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;run;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did I make any mistake there?&amp;nbsp; I am just looking for a better way other than using iml. Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 09:56:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Partial-Correlation/m-p/514211#M2683</guid>
      <dc:creator>kakahingwong</dc:creator>
      <dc:date>2018-11-18T09:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Partial Correlation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Partial-Correlation/m-p/514231#M2689</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247122"&gt;@kakahingwong&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you want to compute partial correlations based on an existing correlation dataset. This is possible. However, it seems that PROC CORR doesn't like to&amp;nbsp;process its own output datasets: You must have got the log message&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#008000"&gt;WARNING: The input TYPE=CORR data set is treated as an ordinary SAS data set in proc CORR.&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;in addition to (as you noticed) nonsense results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Luckily, there are other procedures which&amp;nbsp;honor TYPE=CORR datasets as input. The documentation (&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_appssds_sect008.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_blank"&gt;TYPE=CORR Data Sets&lt;/A&gt;) mentions PROC REG among others. This is fortunate because PROC REG is capable of computing partial correlations: see &lt;A href="https://www.lexjansen.com/pharmasug/2010/SP/SP01.pdf" target="_blank"&gt;this PharmaSUG 2010 paper&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, I create a new correlation dataset from your dataset TEST with&amp;nbsp;renamed variables because a TYPE=CORR dataset created with PROC CORR would contain the variables whose names are listed in variable _NAME_. Then I use PROC REG with the PCORR2 option of the MODEL statement (as suggested by the paper) to compute the &lt;EM&gt;square&lt;/EM&gt; of the desired partial correlation coefficient and the corresponding p-value. Finally, I apply the SQRT function to obtain the&amp;nbsp;&lt;SPAN&gt;partial correlation coefficient (variable PARTCORR).&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have(type=corr);
set test;
rename x1=SP x2=EFB_POST x3=SPR x4=EFR x5=ECFA x6=HGC x7=NLT x8=EFB_PRE;
run;

ods output ParameterEstimates=est;
proc reg data=have plots=none;
model SP=EFB_POST SPR EFR / pcorr2;
quit;

data want;
set est;
where dependent='SP' &amp;amp; variable='EFB_POST';
partcorr=sqrt(SqPartCorrTypeII);
keep dependent variable partcorr probt;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is another example using dataset FISH1 from the&amp;nbsp;PROC CORR documentation: &lt;A href="https://documentation.sas.com/?docsetId=procstat&amp;amp;docsetTarget=procstat_corr_examples09.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;Example 2.6 Computing Cronbach’s Coefficient Alpha&lt;/A&gt;. I used this to compare the results from PROC REG (as above) to the results from PROC CORR with the PARTIAL statement (obtained&amp;nbsp;from the original data rather than a TYPE=CORR dataset).&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fish1c;
set fish1;
if weight; /* remove an observation with a missing WEIGHT value */
run; /* 34 obs. */

ods output PartialPearsonCorr=ppc;
proc corr data=fish1c;
   var Height Width;
   partial Length3 Weight3;
run;

proc print data=ppc;
format _numeric_ best12.;
run;

proc corr data=fish1c outp=corrmat noprint;
   var Height Width Length3 Weight3;
run;

ods select none;
ods output ParameterEstimates=parest;
proc reg data=corrmat plots=none;
model Height=Width Length3 Weight3 / pcorr2;
quit;
ods select all;

data target;
set parest;
where dependent='Height' &amp;amp; variable='Width';
partcorr=sqrt(SqPartCorrTypeII);
keep dependent variable partcorr probt;
run;

proc print data=target;
format partcorr probt best12.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;If you compare the two PROC PRINT outputs, you'll see that both the partial correlation coefficient and the corresponding p-value in dataset TARGET (obtained from the TYPE=CORR dataset&amp;nbsp;using PROC REG) are equal (at least after rounding to 10 decimal places) to the results from PROC CORR in dataset PPC.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 13:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Partial-Correlation/m-p/514231#M2689</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-11-18T13:55:23Z</dc:date>
    </item>
  </channel>
</rss>

