<?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: Output full matrix of tetrachoric correlations in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834357#M41314</link>
    <description>Always the best, Reeza. Thank you!</description>
    <pubDate>Tue, 20 Sep 2022 18:53:34 GMT</pubDate>
    <dc:creator>awesome_opossum</dc:creator>
    <dc:date>2022-09-20T18:53:34Z</dc:date>
    <item>
      <title>Output full matrix of tetrachoric correlations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834346#M41311</link>
      <description>&lt;P&gt;Hi, I'm trying to output a full matrix of tetrachoric correlations, like the matrix produced by proc corr outp= option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="awesome_opossum_0-1663696887080.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75407iDB06DE9EC950BF8A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="awesome_opossum_0-1663696887080.png" alt="awesome_opossum_0-1663696887080.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Proc corr does have an option for outputting tetrachoric correlations:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc corr data = data polychoric;&lt;BR /&gt;var var1 var2 var3 var4;&lt;BR /&gt;ods output PolychoricCorr = tcorr;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it outputs the data like so:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="awesome_opossum_1-1663696962598.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75408i5A2580F8DE505885/image-size/medium?v=v2&amp;amp;px=400" role="button" title="awesome_opossum_1-1663696962598.png" alt="awesome_opossum_1-1663696962598.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've heard there are macros out there that can do this, but I'm wondering if there's maybe a simpler solution or other procedure/option that could do this without having to bother with a macro?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively (as I also posted in Programming community), I am open to method that could shift the column values into the matrix, if there is one that isn't too dangerously complicated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also alternatively, I might be open to getting a full matrix of Yule's Y instead of the tetrachoric correlations, if anyone knows how to do that and it is easier.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 18:05:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834346#M41311</guid>
      <dc:creator>awesome_opossum</dc:creator>
      <dc:date>2022-09-20T18:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Output full matrix of tetrachoric correlations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834352#M41312</link>
      <description>&lt;P&gt;Not aware of an option/procedure. You basically need to do the data manipulation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data tcorr2;
	set tcorr;
	by var;
	output;
	t_var=withVar;
	withVar=var;
	var=t_var;
	output;
	drop t_var;
run;

proc sort data=tcorr2;
	by var withVar;
run;

data tcorr3;
	set tcorr2;
	by var;
	output;

	if first.var then
		do;
			withVar=var;
			corr=1;
			output;
		end;
run;

proc sort data=tcorr3;
	by var withVar;
run;

proc transpose data=tcorr3 out=want;
	by var;
	id withVar;
	var corr;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Sep 2022 18:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834352#M41312</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-09-20T18:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Output full matrix of tetrachoric correlations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834353#M41313</link>
      <description>When you are looking for a particular statistic in SAS, check the list of Frequently Asked-for Statistics (FASTats)&amp;nbsp;in the Important Links section of the Statistical Procedures Community page. As noted there in the "Tetrachoric correlation matrix" and "Correlations" items, you can use the OUTPLC= option in PROC CORR.</description>
      <pubDate>Tue, 20 Sep 2022 18:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834353#M41313</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-09-20T18:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Output full matrix of tetrachoric correlations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834357#M41314</link>
      <description>Always the best, Reeza. Thank you!</description>
      <pubDate>Tue, 20 Sep 2022 18:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834357#M41314</guid>
      <dc:creator>awesome_opossum</dc:creator>
      <dc:date>2022-09-20T18:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Output full matrix of tetrachoric correlations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834451#M41321</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*It is a SAS/IML thing*/
data have;
   input var $ withvar $ corr;
datalines;
var1 var2  0.096
var1 var3  -0.062
var1 var4  0.097
var2 var3  -0.413
var2 var4  -0.0037
var3 var4  0.074
;

proc iml;
use have;
read all var{var withvar corr};
close;
x=corr||num(compress(var,,'kd'))||num(compress(withvar,,'kd'));
f=full(x);
n=ncol(f);
w=f//j(1,n,0);
want=w+t(w)+i(n);
vname='var1':'var'+char(n);
create want from want[c=vname r=vname ];
append from want[r=vname];
close;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Sep 2022 11:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Output-full-matrix-of-tetrachoric-correlations/m-p/834451#M41321</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-21T11:51:42Z</dc:date>
    </item>
  </channel>
</rss>

