<?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 How to get the median and other quantiles of data in the same row of several vectors? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105027#M780</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to get the median and other quantiles of data in the same row of several vectors using IML functions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jul 2012 08:31:35 GMT</pubDate>
    <dc:creator>ShufeGuoding</dc:creator>
    <dc:date>2012-07-12T08:31:35Z</dc:date>
    <item>
      <title>How to get the median and other quantiles of data in the same row of several vectors?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105027#M780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to get the median and other quantiles of data in the same row of several vectors using IML functions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 08:31:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105027#M780</guid>
      <dc:creator>ShufeGuoding</dc:creator>
      <dc:date>2012-07-12T08:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the median and other quantiles of data in the same row of several vectors?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105028#M781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look at the &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/64248/HTML/default/viewer.htm#imlug_langref_sect232.htm"&gt;QNTL subroutine&lt;/A&gt;. The QNTL function operates on columns of a matrix, so if you have several vectors you can concatenate them together (use the || operator)&amp;nbsp; and compute all the quantiles at once.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 10:34:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105028#M781</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-07-12T10:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the median and other quantiles of data in the same row of several vectors?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105029#M782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to do it using SAS 9.2IML? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2012 00:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105029#M782</guid>
      <dc:creator>ShufeGuoding</dc:creator>
      <dc:date>2012-07-27T00:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the median and other quantiles of data in the same row of several vectors?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105030#M783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could adapt my code here which uses the SAS pctl function:&lt;/P&gt;&lt;P&gt;&lt;A href="http://listserv.uga.edu/cgi-bin/wa?A2=ind0812A&amp;amp;L=sas-l&amp;amp;D=0&amp;amp;P=35674"&gt;http://listserv.uga.edu/cgi-bin/wa?A2=ind0812A&amp;amp;L=sas-l&amp;amp;D=0&amp;amp;P=35674&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But this is not a workable solution unless your matrices will always be small.&amp;nbsp; As Dale said in the same thread:&lt;/P&gt;&lt;P&gt;&lt;A href="http://listserv.uga.edu/cgi-bin/wa?A2=ind0812A&amp;amp;L=sas-l&amp;amp;D=0&amp;amp;P=37690"&gt;http://listserv.uga.edu/cgi-bin/wa?A2=ind0812A&amp;amp;L=sas-l&amp;amp;D=0&amp;amp;P=37690&lt;/A&gt;&lt;/P&gt;&lt;P&gt;you will probably be better off building your own percentile function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2012 07:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105030#M783</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2012-07-27T07:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the median and other quantiles of data in the same row of several vectors?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105031#M784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; proc iml;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; start myQntl(q, x, p);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* definition 5 from UNIVARIATE doc */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y = colvec(x);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call sort(y,1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = nrow(y);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* assume nonmissing data */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q = j(ncol(p),1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 1 to ncol(p);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j&amp;nbsp; = (n+1)*p&lt;I&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* position in ordered data */&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j1 = floor(j); j2 = ceil(j);/* indices into ordered data */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print j j1 j2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if j1=j2 then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* return a datum */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q&lt;I&gt; = y[j1];&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* interpolate between data */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q&lt;I&gt; = (y[j2]+y[j1])/2;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* test it */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; x = ranuni(j(100,1));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; p = {0.1 0.25 0.5 0.75 0.9};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call MyQntl(q, x, p);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; print q;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2012 11:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-median-and-other-quantiles-of-data-in-the-same/m-p/105031#M784</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-07-27T11:15:02Z</dc:date>
    </item>
  </channel>
</rss>

