<?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: Calculation of medcouple in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/946008#M370539</link>
    <description>Have a look at this paper: &lt;A href="https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-158.pdf" target="_blank"&gt;https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-158.pdf&lt;/A&gt;</description>
    <pubDate>Wed, 02 Oct 2024 18:27:24 GMT</pubDate>
    <dc:creator>JosvanderVelden</dc:creator>
    <dc:date>2024-10-02T18:27:24Z</dc:date>
    <item>
      <title>Calculation of medcouple</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/447688#M112514</link>
      <description>&lt;P&gt;I am looking for SAS code to calculate the medcouple, has anyone such knowledge?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Medcouple" target="_blank"&gt;https://en.wikipedia.org/wiki/Medcouple&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 07:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/447688#M112514</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2018-03-22T07:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of medcouple</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/447738#M112533</link>
      <description>&lt;P&gt;It is my first time to hear this term. I don't know if&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; could write some IML code to make it happen.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 12:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/447738#M112533</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-22T12:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of medcouple</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/447752#M112541</link>
      <description>&lt;P&gt;Unfortunately, I need it in&amp;nbsp;SAS BASE, and not in SAS IML.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 12:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/447752#M112541</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2018-03-22T12:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of medcouple</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/447755#M112544</link>
      <description>&lt;P&gt;I am familiar with this concept, but I do not have any non-IML code to share.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 12:58:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/447755#M112544</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-03-22T12:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of medcouple</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/458249#M116257</link>
      <description>&lt;P&gt;Here's&amp;nbsp;the brute force way.&amp;nbsp; I.e. it doesn't take advantage of the "fast" algorithm in the Wikipedia reference. so it won't scale well against larger datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The example finds the medcouple stat for variable CLOSE in sashelp.stocks for IBM stocks (N=233).&amp;nbsp; If you have a test data set to confirm correctness of the algorithm, I'd suggest running it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have (keep=date close);
  set sashelp.stocks;
  where stock='IBM';
run;


proc means data=have noprint;
  output out=median  median=median;
  var close;
run;


data vneed (keep=h) / view=vneed;
  set have end=end_of_have;
  if _n_=1 then set median;

  array upper{2000} _temporary_; /* distance of upper obs to median*/
  array lower{2000} _temporary_; /* distance of lower obs to median*/

  if close&amp;gt;=median then do;
    P+1;
    upper{p}=close-median;
  end;
  if close&amp;lt;=median then do;
    Q+1;
    lower{q}=median-close;
  end;

  if end_of_have;
  do i=1 to P;
    do j=1 to Q;
      if upper{i}=0 and lower{j}=0 then h=sign(P-1-i-j);
      else h= (upper{i}-lower{j})/(upper{i}+lower{j});
      output;
    end;
  end;
run;
proc means data=vneed median; var h;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Apr 2018 20:17:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/458249#M116257</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-04-27T20:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of medcouple</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/637282#M189441</link>
      <description>&lt;P&gt;Hi, I'm newbie here. may I clarify a&lt;SPAN style="font-family: inherit;"&gt;rray upper {2000} and lower {2000}?&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;is the 2000 is the max &amp;amp; min value of the dataset?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 14:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/637282#M189441</guid>
      <dc:creator>peiting</dc:creator>
      <dc:date>2020-04-03T14:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of medcouple</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/946008#M370539</link>
      <description>Have a look at this paper: &lt;A href="https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-158.pdf" target="_blank"&gt;https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-158.pdf&lt;/A&gt;</description>
      <pubDate>Wed, 02 Oct 2024 18:27:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-medcouple/m-p/946008#M370539</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2024-10-02T18:27:24Z</dc:date>
    </item>
  </channel>
</rss>

