<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/math.percentRank.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>math.percentRank</api:function-name><api:suggest>math.percentrank</api:suggest><api:suggest>math</api:suggest><api:suggest>percentrank</api:suggest><api:function-link mode="xquery" fullname="math:percent-rank">/apidoc/8.0/math:percent-rank.xml</api:function-link><api:function mode="javascript" name="percentRank" type="builtin" lib="math" category="MathBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="math" namespace="http://marklogic.com/xdmp/math" fullname="math.percentRank"><api:summary>
  Returns the rank of a value in a data set as a percentage of the data set.
  If the given value is not equal to any item in the sequence, the function
  returns the empty sequence. See <code xmlns="http://www.w3.org/1999/xhtml">math:rank</code>.
</api:summary><api:params><api:param name="arg" type="xs:anyAtomicType*"><api:param-description>
  The sequence of values.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>(String | Number | Boolean | null)[]</api:param-type></api:param><api:param name="value" type="xs:anyAtomicType"><api:param-description>
  The value to be "ranked".
  </api:param-description><api:param-name>value</api:param-name><api:param-type>xs.anyAtomicType</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
    Options.  The default is ().
    <p xmlns="http://www.w3.org/1999/xhtml">
      Options include:</p>
      <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
        <dt>"ascending"(default)</dt>
        <dd>Rank the value as if the sequence was sorted in ascending order.
        </dd>
        <dt>"descending"</dt>
        <dd>Rank the value as if the sequence was sorted in descending order.
        </dd>
        <dt>"collation=<em>URI</em>"</dt>
        <dd>Applies only when $arg is of the xs:string type. If no specified,
        the default collation is used.</dd>
        <dt>"coordinate-system=<em>name</em>"</dt>
        <dd>Applies only when $arg is of the cts:point type. If no specified,
        the default coordinate system is used.</dd>
      </dl></blockquote>
  </api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>Number?</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  math.percentRank([1, 7, 5, 5, 10, 9],9)

  =&gt; 0.833333333333333
</pre></api:example></api:function></api:function-page>