<?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: Adding P-value inside Pearson correlation the heat map or Stars for significance in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567484#M18344</link>
    <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only got the heat map matrix as below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV class="c"&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV class="c"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGRender7.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30419i51C88A351AA3FD83/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGRender7.png" alt="SGRender7.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2019 23:55:04 GMT</pubDate>
    <dc:creator>Huss</dc:creator>
    <dc:date>2019-06-19T23:55:04Z</dc:date>
    <item>
      <title>Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567373#M18331</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble adding the P-value inside the Pearson correlation heat map. Can anyone help me with that please? Below is part of my data and the code I am using to create the heat map but I do not know how to include the P-value statement .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hussien&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.Almtarfi_2;&lt;BR /&gt;input Cult Biomass_BRC Biomass_RB yield_BRC Yield_RB Height_BRC Heigh_RB;&lt;BR /&gt;CARDS;&lt;BR /&gt;1930 62.125 75.255 2563.16 2196.06 123.075 142.8&lt;BR /&gt;1933 60.62 77.91 2396.49 1965.79 106.233 124.325&lt;BR /&gt;1935 51.275 77.2 2317.14 2490.56 114.75 137.25&lt;BR /&gt;1940 63.31 73.025 2738.19 2888.38 142.85 169.5&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;/*Code below by Chris Hemedinger, found on the SAS blogs*/&lt;BR /&gt;&lt;BR /&gt;/* Prepare the correlations coeff matrix: Pearson's r method */&lt;BR /&gt;%macro prepCorrData(in=,out=);&lt;BR /&gt;/* Run corr matrix for input data, all numeric vars */&lt;BR /&gt;proc corr data=&amp;amp;in. noprint&lt;BR /&gt;pearson&lt;BR /&gt;outp=work._tmpCorr&lt;BR /&gt;vardef=df&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/* prep data for heat map */&lt;BR /&gt;data &amp;amp;out.;&lt;BR /&gt;keep x y r;&lt;BR /&gt;set work._tmpCorr(where=(_TYPE_="CORR"));&lt;BR /&gt;array v{*} _numeric_;&lt;BR /&gt;x = _NAME_;&lt;BR /&gt;do i = dim(v) to 1 by -1;&lt;BR /&gt;y = vname(v(i));&lt;BR /&gt;r = v(i);&lt;BR /&gt;/* creates a lower triangular matrix */&lt;BR /&gt;if (i&amp;lt;_n_) then&lt;BR /&gt;r=.;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc datasets lib=work nolist nowarn;&lt;BR /&gt;delete _tmpcorr;&lt;BR /&gt;quit;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;/* Create a heat map implementation of a correlation matrix */&lt;BR /&gt;ods path work.mystore(update) sashelp.tmplmst(read);&lt;BR /&gt;&lt;BR /&gt;proc template;&lt;BR /&gt;define statgraph corrHeatmap;&lt;BR /&gt;dynamic _Title;&lt;BR /&gt;begingraph;&lt;BR /&gt;entrytitle _Title;&lt;BR /&gt;rangeattrmap name='map';&lt;BR /&gt;/* select a series of colors that represent a "diverging" */&lt;BR /&gt;/* range of values: stronger on the ends, weaker in middle */&lt;BR /&gt;/* Get ideas from &lt;A href="http://colorbrewer.org" target="_blank"&gt;http://colorbrewer.org&lt;/A&gt; */&lt;BR /&gt;range -1 - 1 / rangecolormodel=(cxD8B365 cxF5F5F5 cx5AB4AC);&lt;BR /&gt;endrangeattrmap;&lt;BR /&gt;rangeattrvar var=r attrvar=r attrmap='map';&lt;BR /&gt;layout overlay /&lt;BR /&gt;xaxisopts=(display=(line ticks tickvalues))&lt;BR /&gt;yaxisopts=(display=(line ticks tickvalues));&lt;BR /&gt;heatmapparm x = x y = y colorresponse = r /&lt;BR /&gt;xbinaxis=false ybinaxis=false&lt;BR /&gt;name = "heatmap" display=all;&lt;BR /&gt;continuouslegend "heatmap" /&lt;BR /&gt;orient = vertical location = outside title="Pearson Correlation";&lt;BR /&gt;endlayout;&lt;BR /&gt;endgraph;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/* Build the graphs */&lt;BR /&gt;ods graphics /height=600 width=800 imagemap;&lt;BR /&gt;&lt;BR /&gt;%prepCorrData(in=work.Almtarfi_2,out=work.Almtarfi_r);&lt;BR /&gt;proc sgrender data=work.Almtarfi_r template=corrHeatmap;&lt;BR /&gt;dynamic _title="Correlation matrix for all variables";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;ods graphics off;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 17:30:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567373#M18331</guid>
      <dc:creator>Huss</dc:creator>
      <dc:date>2019-06-19T17:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567377#M18332</link>
      <description>&lt;P&gt;Please always provide a reference if you are using code from someone else. It enables the experts to review how the code works. For this example, it appears that the code is from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;'s blog post &lt;A href="https://blogs.sas.com/content/sasdummy/2013/06/12/correlations-matrix-heatmap-with-sas/" target="_self"&gt;"How to build a correlations hear map with SAS."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 17:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567377#M18332</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-06-19T17:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567381#M18333</link>
      <description>&lt;P&gt;Thank you so much Rick. Really appreciate your help. Can you still help me with&amp;nbsp; including the P-value statement to the code, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 17:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567381#M18333</guid>
      <dc:creator>Huss</dc:creator>
      <dc:date>2019-06-19T17:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567385#M18334</link>
      <description>Where do you want the p-values? Inside the squares? Or do you want asterisks to categorize p-values? I tried that, it was way too busy IMO. &lt;BR /&gt;&lt;BR /&gt;That's actually a pretty old post (6+ years), there's easier ways in SGPLOT now, is there a specific reason you've chosen to use SGRENDER and GTL instead of SGPLOT?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Jun 2019 18:05:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567385#M18334</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-19T18:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567386#M18335</link>
      <description>And which version of SAS do you have?&lt;BR /&gt;Such as 9.4TS1M5?</description>
      <pubDate>Wed, 19 Jun 2019 18:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567386#M18335</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-19T18:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567394#M18336</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help. The SAS I am using is SAS 9.4 TS leveL 1M5. I want either P-value or the star (if is possible and can fit)&amp;nbsp; inside the square, please? The only reason to use this code is because I could not find another one . Therefore, if you could help me with another one that is easier to deal with , I would really really appreciate it. Again I really appreciate your time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hussien&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 18:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567394#M18336</guid>
      <dc:creator>Huss</dc:creator>
      <dc:date>2019-06-19T18:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567411#M18337</link>
      <description>Make sure to search here. You can restrict your Google searches to this site by using "heatmap correlation site:communities.sas.com" as your search term. &lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/Graphics-Programming/Removing-one-of-the-legends-from-a-heatmap/m-p/456131" target="_blank"&gt;https://communities.sas.com/t5/Graphics-Programming/Removing-one-of-the-legends-from-a-heatmap/m-p/456131&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Apparently I answered this question about a year ago &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Jun 2019 19:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567411#M18337</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-19T19:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567420#M18338</link>
      <description>&lt;P&gt;the article &lt;A href="https://blogs.sas.com/content/iml/2015/08/17/heat-maps-sgplot.html" target="_self"&gt;"Create heat maps with PROC SGPLOT"&lt;/A&gt; provides an example of overlaying text on a heatmap by using the HEATMAP and TEXt statements in PROC SGPLOT. Although the example in the article is a frequency table and not a correlation matrix, the idea is the same.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 19:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567420#M18338</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-06-19T19:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567445#M18339</link>
      <description>&lt;P&gt;Here is my solution.&amp;nbsp; I used ODS OUTPUT to get the p-values and TEXTPLOT to graph them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.Almtarfi_2;
input Cult Biomass_BRC Biomass_RB yield_BRC Yield_RB Height_BRC Heigh_RB;
CARDS;
1930 62.125 75.255 2563.16 2196.06 123.075 142.8
1933 60.62 77.91 2396.49 1965.79 106.233 124.325
1935 51.275 77.2 2317.14 2490.56 114.75 137.25
1940 63.31 73.025 2738.19 2888.38 142.85 169.5



/*Code below by Chris Hemedinger, found on the SAS blogs*/
ods trace off;
/* Prepare the correlations coeff matrix: Pearson's r method */
%macro prepCorrData(in=,out=);
/* Run corr matrix for input data, all numeric vars */
ods select none; ods noresults;
ods output PearsonCorr=blah;
proc corr data=&amp;amp;in. pearson 
outp=work._tmpCorr
vardef=df
;
run;
ods results;
ods select all;
proc sql noprint;
    select variable into :vlist separated by '|' from blah;
quit;
/* prep data for heat map */
data &amp;amp;out.;
keep x y r p;
set blah (rename=(variable=_name_));
*set work._tmpCorr(where=(_TYPE_="CORR"));
array v{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); %scan(%superq(vlist),&amp;amp;i,|) %end;;
array pval{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); p%scan(%superq(vlist),&amp;amp;i,|) %end;;
x = _NAME_;
do i = dim(v) to 1 by -1;
y = vname(v(i));
r = v(i);
p = pval(i);

/* creates a lower triangular matrix */
if (i&amp;lt;_n_) then do;
r=.;p=.;
end;
output;
end;
run;

proc datasets lib=work nolist nowarn;
delete _tmpcorr;
quit;
%mend;
options mprint;
/* Create a heat map implementation of a correlation matrix */
ods path work.mystore(update) sashelp.tmplmst(read);

proc template;
define statgraph corrHeatmap;
dynamic _Title;
begingraph;
entrytitle _Title;
rangeattrmap name='map';
/* select a series of colors that represent a "diverging" */
/* range of values: stronger on the ends, weaker in middle */
/* Get ideas from http://colorbrewer.org */
range -1 - 1 / rangecolormodel=(cxD8B365 cxF5F5F5 cx5AB4AC);
endrangeattrmap;
rangeattrvar var=r attrvar=r attrmap='map';
layout overlay /
xaxisopts=(display=(line ticks tickvalues))
yaxisopts=(display=(line ticks tickvalues));
heatmapparm x = x y = y colorresponse = r /
xbinaxis=false ybinaxis=false
name = "heatmap" display=all;
textplot x=x y=y text=p;
continuouslegend "heatmap" /
orient = vertical location = outside title="Pearson Correlation";
endlayout;
endgraph;
end;
run;

/* Build the graphs */
ods graphics /height=600 width=800 imagemap;

%prepCorrData(in=work.Almtarfi_2,out=work.Almtarfi_r);
proc sgrender data=work.Almtarfi_r template=corrHeatmap;
dynamic _title="Correlation matrix for all variables";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGRender.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30418iC4463EDA625FDD48/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGRender.png" alt="SGRender.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 13:45:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567445#M18339</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2019-06-20T13:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567473#M18340</link>
      <description>&lt;P&gt;Hi JeffMeyers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help. When running the code , I am getting errors as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MPRINT(PREPCORRDATA): data work.Almtarfi_r;&lt;BR /&gt;MPRINT(PREPCORRDATA): keep x y r p;&lt;BR /&gt;MPRINT(PREPCORRDATA): set blah (rename=(variable=_name_));&lt;BR /&gt;ERROR: File WORK.BLAH.DATA does not exist.&lt;BR /&gt;MPRINT(PREPCORRDATA): *set work._tmpCorr(where=(_TYPE_="CORR"));&lt;BR /&gt;WARNING: Apparent symbolic reference VLIST not resolved.&lt;BR /&gt;MPRINT(PREPCORRDATA): array v{*};&lt;BR /&gt;ERROR: The array v has been defined with zero elements.&lt;BR /&gt;WARNING: Apparent symbolic reference VLIST not resolved.&lt;BR /&gt;MPRINT(PREPCORRDATA): array pval{*};&lt;BR /&gt;ERROR: The array pval has been defined with zero elements.&lt;BR /&gt;MPRINT(PREPCORRDATA): x = _NAME_;&lt;BR /&gt;MPRINT(PREPCORRDATA): do i = dim(v) to 1 by -1;&lt;BR /&gt;ERROR: Too many array subscripts specified for array v.&lt;BR /&gt;MPRINT(PREPCORRDATA): y = vname(v(i));&lt;BR /&gt;MPRINT(PREPCORRDATA): r = v(i);&lt;BR /&gt;ERROR: Too many array subscripts specified for array v.&lt;BR /&gt;MPRINT(PREPCORRDATA): p = pval(i);&lt;BR /&gt;ERROR: Too many array subscripts specified for array pval.&lt;BR /&gt;MPRINT(PREPCORRDATA): if (i&amp;lt;_n_) then do;&lt;BR /&gt;MPRINT(PREPCORRDATA): r=.;&lt;BR /&gt;MPRINT(PREPCORRDATA): p=.;&lt;BR /&gt;MPRINT(PREPCORRDATA): end;&lt;BR /&gt;MPRINT(PREPCORRDATA): output;&lt;BR /&gt;MPRINT(PREPCORRDATA): end;&lt;BR /&gt;MPRINT(PREPCORRDATA): run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please, help to see whey I have all these errors, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 22:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567473#M18340</guid>
      <dc:creator>Huss</dc:creator>
      <dc:date>2019-06-19T22:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567475#M18341</link>
      <description>What happens when you run the PROC CORR with the ODS OUTPUT statement that I put before it?  And then the PROC SQL code that I had listed?</description>
      <pubDate>Wed, 19 Jun 2019 22:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567475#M18341</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2019-06-19T22:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567479#M18342</link>
      <description>&lt;P&gt;When running the code below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods output PearsonCorr=blah;&lt;BR /&gt;ods select none; ods noresults;&lt;BR /&gt;proc corr data=&amp;amp;in. pearson&lt;BR /&gt;outp=work._tmpCorr&lt;BR /&gt;vardef=df&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;ods results;&lt;BR /&gt;ods select all;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select variable into :vlist separated by '|' from blah;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2476 ods results;&lt;BR /&gt;2477 ods select all;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2478 proc sql noprint;&lt;BR /&gt;2479 select variable into :vlist separated by '|' from blah;&lt;BR /&gt;ERROR: File WORK.BLAH.DATA does not exist.&lt;BR /&gt;2480 quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any hunt, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 23:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567479#M18342</guid>
      <dc:creator>Huss</dc:creator>
      <dc:date>2019-06-19T23:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567481#M18343</link>
      <description>It looks like the actual PROC CORR isn't running.  Try deleting the comments around the procedure to make sure the procedure isn't accidentally being commented out.</description>
      <pubDate>Wed, 19 Jun 2019 23:31:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567481#M18343</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2019-06-19T23:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567484#M18344</link>
      <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only got the heat map matrix as below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV class="c"&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV class="c"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGRender7.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30419i51C88A351AA3FD83/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGRender7.png" alt="SGRender7.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 23:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567484#M18344</guid>
      <dc:creator>Huss</dc:creator>
      <dc:date>2019-06-19T23:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567485#M18345</link>
      <description>Can you copy and paste the exact code you're running now, just so I can check if you're running the same thing that I posted?</description>
      <pubDate>Thu, 20 Jun 2019 00:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567485#M18345</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2019-06-20T00:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567491#M18346</link>
      <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code I copyied and used after deleting comments:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.Almtarfi_2;&lt;BR /&gt;input Cult Biomass_BRC Biomass_RB yield_BRC Yield_RB Height_BRC Heigh_RB;&lt;BR /&gt;CARDS;&lt;BR /&gt;1930 62.125 75.255 2563.16 2196.06 123.075 142.8&lt;BR /&gt;1933 60.62 77.91 2396.49 1965.79 106.233 124.325&lt;BR /&gt;1935 51.275 77.2 2317.14 2490.56 114.75 137.25&lt;BR /&gt;1940 63.31 73.025 2738.19 2888.38 142.85 169.5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods trace off;&lt;/P&gt;&lt;P&gt;%macro prepCorrData(in=,out=);&lt;/P&gt;&lt;P&gt;ods output PearsonCorr=blah;&lt;BR /&gt;ods select none; ods noresults;&lt;BR /&gt;proc corr data=&amp;amp;in. pearson&lt;BR /&gt;outp=work._tmpCorr&lt;BR /&gt;vardef=df;&lt;BR /&gt;run;&lt;BR /&gt;ods results;&lt;BR /&gt;ods select all;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select variable into :vlist separated by '|' from blah;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data &amp;amp;out.;&lt;BR /&gt;keep x y r p;&lt;BR /&gt;set blah (rename=(variable=_name_));&lt;/P&gt;&lt;P&gt;array v{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); %scan(%superq(vlist),&amp;amp;i,|) %end;;&lt;BR /&gt;array pval{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); p%scan(%superq(vlist),&amp;amp;i,|) %end;;&lt;BR /&gt;x = _NAME_;&lt;BR /&gt;do i = dim(v) to 1 by -1;&lt;BR /&gt;y = vname(v(i));&lt;BR /&gt;r = v(i);&lt;BR /&gt;p = pval(i);&lt;/P&gt;&lt;P&gt;if (i&amp;lt;_n_) then do;&lt;BR /&gt;r=.;p=.;&lt;BR /&gt;end;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc datasets lib=work nolist nowarn;&lt;BR /&gt;delete _tmpcorr;&lt;BR /&gt;quit;&lt;BR /&gt;%mend;&lt;BR /&gt;options mprint;&lt;/P&gt;&lt;P&gt;ods path work.mystore(update) sashelp.tmplmst(read);&lt;/P&gt;&lt;P&gt;proc template;&lt;BR /&gt;define statgraph corrHeatmap;&lt;BR /&gt;dynamic _Title;&lt;BR /&gt;begingraph;&lt;BR /&gt;entrytitle _Title;&lt;BR /&gt;rangeattrmap name='map';&lt;/P&gt;&lt;P&gt;range -1 - 1 / rangecolormodel=(cxD8B365 cxF5F5F5 cx5AB4AC);&lt;BR /&gt;endrangeattrmap;&lt;BR /&gt;rangeattrvar var=r attrvar=r attrmap='map';&lt;BR /&gt;layout overlay /&lt;BR /&gt;xaxisopts=(display=(line ticks tickvalues))&lt;BR /&gt;yaxisopts=(display=(line ticks tickvalues));&lt;BR /&gt;heatmapparm x = x y = y colorresponse = r /&lt;BR /&gt;xbinaxis=false ybinaxis=false&lt;BR /&gt;name = "heatmap" display=all;&lt;BR /&gt;textplot x=x y=y text=p;&lt;BR /&gt;continuouslegend "heatmap" /&lt;BR /&gt;orient = vertical location = outside title="Pearson Correlation";&lt;BR /&gt;endlayout;&lt;BR /&gt;endgraph;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ods graphics /height=600 width=800 imagemap;&lt;/P&gt;&lt;P&gt;%prepCorrData(in=work.Almtarfi_2,out=work.Almtarfi_r);&lt;BR /&gt;proc sgrender data=work.Almtarfi_r template=corrHeatmap;&lt;BR /&gt;dynamic _title="Correlation matrix for all variables";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 00:53:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567491#M18346</guid>
      <dc:creator>Huss</dc:creator>
      <dc:date>2019-06-20T00:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567499#M18347</link>
      <description>&lt;P&gt;OK I ran what you had and got the same errors.&amp;nbsp; I fixed it by changing the order before the proc corr.&amp;nbsp; Put the ODS OUTPUT after the ODS NORESULTS statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
ods select none; ods noresults;
ods output PearsonCorr=blah;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jun 2019 01:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567499#M18347</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2019-06-20T01:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567543#M18348</link>
      <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is working properly and the matrix looks good. Thank you so much for your help and time. However, I noticed when using big set of data the , the map is so busy. Is there possibility to use&amp;nbsp; * for P &amp;lt;0.05 and&amp;nbsp; and ** for P &amp;lt;0.001 ,&amp;nbsp; *** for&amp;nbsp;P &amp;lt;0.0001, and nothing when P &amp;gt; 0.05? That might make it more&amp;nbsp; clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 06:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567543#M18348</guid>
      <dc:creator>Huss</dc:creator>
      <dc:date>2019-06-20T06:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567614#M18352</link>
      <description>&lt;P&gt;I did this by making a format for the p-values and applying it.&amp;nbsp; I added an ENTRYFOOTNOTE for a footnote clarifying the symbols, and you can change the text to be what you'd like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.Almtarfi_2;
input Cult Biomass_BRC Biomass_RB yield_BRC Yield_RB Height_BRC Heigh_RB;
CARDS;
1930 62.125 75.255 2563.16 2196.06 123.075 142.8
1933 60.62 77.91 2396.49 1965.79 106.233 124.325
1935 51.275 77.2 2317.14 2490.56 114.75 137.25
1940 63.31 73.025 2738.19 2888.38 142.85 169.5
;
run;
proc format;

    value pvaldots
        0-&amp;lt;0.0001 = '***'
        0.0001-&amp;lt;0.001 = '**'
        0.001-&amp;lt;0.05 = '*'
        0.05-high =' '
        other = ' ';
run;
        * for P &amp;lt;0.05 and  and ** for P &amp;lt;0.001 ,  *** for P &amp;lt;0.0001, and nothing when P &amp;gt; 0.05;
/*Code below by Chris Hemedinger, found on the SAS blogs*/
ods trace off;
/* Prepare the correlations coeff matrix: Pearson's r method */
%macro prepCorrData(in=,out=);
/* Run corr matrix for input data, all numeric vars */
ods select none; ods noresults;
ods output PearsonCorr=blah;
proc corr data=&amp;amp;in. pearson 
outp=work._tmpCorr
vardef=df
;
run;
ods results;
ods select all;
proc sql noprint;
    select variable into :vlist separated by '|' from blah;
quit;
/* prep data for heat map */
data &amp;amp;out.;
keep x y r p;
format p pvaldots.;
set blah (rename=(variable=_name_));
*set work._tmpCorr(where=(_TYPE_="CORR"));
array v{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); %scan(%superq(vlist),&amp;amp;i,|) %end;;
array pval{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); p%scan(%superq(vlist),&amp;amp;i,|) %end;;
x = _NAME_;
do i = dim(v) to 1 by -1;
y = vname(v(i));
r = v(i);
p = pval(i);

/* creates a lower triangular matrix */
if (i&amp;lt;_n_) then do;
r=.;p=.;
end;
output;
end;
run;

proc datasets lib=work nolist nowarn;
delete _tmpcorr;
quit;
%mend;
/* Create a heat map implementation of a correlation matrix */
ods path work.mystore(update) sashelp.tmplmst(read);

proc template;
define statgraph corrHeatmap;
dynamic _Title;
begingraph;
entrytitle _Title;
entryfootnote halign=left '*: P &amp;lt;0.05;**: P &amp;lt;0.001;***: P &amp;lt;0.0001;Blank: P &amp;gt; 0.05' / textattrs=(size=10pt);
rangeattrmap name='map';
/* select a series of colors that represent a "diverging" */
/* range of values: stronger on the ends, weaker in middle */
/* Get ideas from http://colorbrewer.org */
range -1 - 1 / rangecolormodel=(cxD8B365 cxF5F5F5 cx5AB4AC);
endrangeattrmap;
rangeattrvar var=r attrvar=r attrmap='map';
layout overlay /
xaxisopts=(display=(line ticks tickvalues))
yaxisopts=(display=(line ticks tickvalues));
heatmapparm x = x y = y colorresponse = r /
xbinaxis=false ybinaxis=false
name = "heatmap" display=all;
textplot x=x y=y text=p / textattrs=(size=14pt);
continuouslegend "heatmap" /
orient = vertical location = outside title="Pearson Correlation";
endlayout;
endgraph;
end;
run;

/* Build the graphs */
ods graphics /height=600 width=800 imagemap;
%prepCorrData(in=work.Almtarfi_2,out=work.Almtarfi_r);
proc sgrender data=work.Almtarfi_r template=corrHeatmap;
dynamic _title="Correlation matrix for all variables";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGRender.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30428i2AF0A871BBD62963/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGRender.png" alt="SGRender.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 13:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/567614#M18352</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2019-06-20T13:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Adding P-value inside Pearson correlation the heat map or Stars for significance</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/568045#M18357</link>
      <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for again for you&amp;nbsp; help . When adding the proc corr numeric matrix code , I found that it is only adding star instead of&amp;nbsp; two for significant . It is considering for example adding two star only when P- value &amp;lt;0.001 and one if it is equal to 0.001 which is not appropriate. If you look at the p-value in numeric&amp;nbsp; matrix and the stars in the heat map , you see it is not the same significant., for example Height- RB vs Height- BRC. I tested with other data and it is the same. Can you please , help with fixing the ENTRYFOOTNOTE , please&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data work.Almtarfi_2;&lt;BR /&gt;input Cult Biomass_BRC Biomass_RB yield_BRC Yield_RB Height_BRC Heigh_RB;&lt;BR /&gt;CARDS;&lt;BR /&gt;1930 62.125 75.255 2563.16 2196.06 123.075 142.8&lt;BR /&gt;1933 60.62 77.91 2396.49 1965.79 106.233 124.325&lt;BR /&gt;1935 51.275 77.2 2317.14 2490.56 114.75 137.25&lt;BR /&gt;1940 63.31 73.025 2738.19 2888.38 142.85 169.5&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;proc format;&lt;/P&gt;&lt;P&gt;value pvaldots&lt;BR /&gt;0-&amp;lt;0.0001 = '***'&lt;BR /&gt;0.0001-&amp;lt;0.001 = '**'&lt;BR /&gt;0.001-&amp;lt;0.05 = '*'&lt;BR /&gt;0.05-high =' '&lt;BR /&gt;other = ' ';&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;* for P &amp;lt;0.05 and and ** for P &amp;lt;0.001 , *** for P &amp;lt;0.0001, and nothing when P &amp;gt; 0.05;&lt;BR /&gt;/*Code below by Chris Hemedinger, found on the SAS blogs*/&lt;BR /&gt;ods trace off;&lt;BR /&gt;/* Prepare the correlations coeff matrix: Pearson's r method */&lt;BR /&gt;%macro prepCorrData(in=,out=);&lt;BR /&gt;/* Run corr matrix for input data, all numeric vars */&lt;BR /&gt;ods select none; ods noresults;&lt;BR /&gt;ods output PearsonCorr=blah;&lt;BR /&gt;proc corr data=&amp;amp;in. pearson&lt;BR /&gt;outp=work._tmpCorr&lt;BR /&gt;vardef=df;&lt;BR /&gt;run;&lt;BR /&gt;ods results;&lt;BR /&gt;ods select all;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select variable into :vlist separated by '|' from blah;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;PROC CORR DATA=work.Almtarfi_2;&lt;BR /&gt;VAR Cult Biomass_BRC Biomass_RB yield_BRC Yield_RB Height_BRC Heigh_RB;&lt;BR /&gt;WITH Cult Biomass_BRC Biomass_RB yield_BRC Yield_RB Height_BRC Heigh_RB;&lt;BR /&gt;RUN;&lt;BR /&gt;/* prep data for heat map */&lt;BR /&gt;data &amp;amp;out.;&lt;BR /&gt;keep x y r p;&lt;BR /&gt;format p pvaldots.;&lt;BR /&gt;set blah (rename=(variable=_name_));&lt;BR /&gt;*set work._tmpCorr(where=(_TYPE_="CORR"));&lt;BR /&gt;array v{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); %scan(%superq(vlist),&amp;amp;i,|) %end;;&lt;BR /&gt;array pval{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); p%scan(%superq(vlist),&amp;amp;i,|) %end;;&lt;BR /&gt;x = _NAME_;&lt;BR /&gt;do i = dim(v) to 1 by -1;&lt;BR /&gt;y = vname(v(i));&lt;BR /&gt;r = v(i);&lt;BR /&gt;p = pval(i);&lt;/P&gt;&lt;P&gt;/* creates a lower triangular matrix */&lt;BR /&gt;if (i&amp;lt;_n_) then do;&lt;BR /&gt;r=.;p=.;&lt;BR /&gt;end;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc datasets lib=work nolist nowarn;&lt;BR /&gt;delete _tmpcorr;&lt;BR /&gt;quit;&lt;BR /&gt;%mend;&lt;BR /&gt;/* Create a heat map implementation of a correlation matrix */&lt;BR /&gt;ods path work.mystore(update) sashelp.tmplmst(read);&lt;/P&gt;&lt;P&gt;proc template;&lt;BR /&gt;define statgraph corrHeatmap;&lt;BR /&gt;dynamic _Title;&lt;BR /&gt;begingraph;&lt;BR /&gt;entrytitle _Title;&lt;BR /&gt;entryfootnote halign=left '*: P &amp;lt;0.05;**: P &amp;lt;0.001;***: P &amp;lt;0.0001;Blank: P &amp;gt; 0.05' / textattrs=(size=10pt);&lt;BR /&gt;rangeattrmap name='map';&lt;BR /&gt;/* select a series of colors that represent a "diverging" */&lt;BR /&gt;/* range of values: stronger on the ends, weaker in middle */&lt;BR /&gt;/* Get ideas from &lt;A href="http://colorbrewer.org" target="_blank"&gt;http://colorbrewer.org&lt;/A&gt; */&lt;BR /&gt;range -1 - 1 / rangecolormodel=(cxD8B365 cxF5F5F5 cx5AB4AC);&lt;BR /&gt;endrangeattrmap;&lt;BR /&gt;rangeattrvar var=r attrvar=r attrmap='map';&lt;BR /&gt;layout overlay /&lt;BR /&gt;xaxisopts=(display=(line ticks tickvalues))&lt;BR /&gt;yaxisopts=(display=(line ticks tickvalues));&lt;BR /&gt;heatmapparm x = x y = y colorresponse = r /&lt;BR /&gt;xbinaxis=false ybinaxis=false&lt;BR /&gt;name = "heatmap" display=all;&lt;BR /&gt;textplot x=x y=y text=p / textattrs=(size=14pt);&lt;BR /&gt;continuouslegend "heatmap" /&lt;BR /&gt;orient = vertical location = outside title="Pearson Correlation";&lt;BR /&gt;endlayout;&lt;BR /&gt;endgraph;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* Build the graphs */&lt;BR /&gt;ods graphics /height=600 width=800 imagemap;&lt;BR /&gt;%prepCorrData(in=work.Almtarfi_2,out=work.Almtarfi_r);&lt;BR /&gt;proc sgrender data=work.Almtarfi_r template=corrHeatmap;&lt;BR /&gt;dynamic _title="Correlation matrix for all variables";&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 19:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-P-value-inside-Pearson-correlation-the-heat-map-or-Stars/m-p/568045#M18357</guid>
      <dc:creator>Huss</dc:creator>
      <dc:date>2019-06-21T19:12:25Z</dc:date>
    </item>
  </channel>
</rss>

