<?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: In what percentile located specific value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/In-what-percentile-located-specific-value/m-p/944054#M369952</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc rank data=sashelp.cars out=cars_ranks percent;
var invoice;
ranks invoice_r;
run;

proc sort data=cars_ranks;
    by invoice;
run;

data want;
    set cars_ranks;
    prev_invoice=lag(invoice);
    if prev_invoice&amp;lt;50000 and invoice&amp;gt;=50000 then output;
    keep invoice invoice_r;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So 50000 is percentile 91.589 (rounded-off to 3 decimal places).&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2024 12:53:50 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-09-16T12:53:50Z</dc:date>
    <item>
      <title>In what percentile located specific value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-what-percentile-located-specific-value/m-p/944053#M369951</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I know how to calculate percentiles of specific variable.&lt;/P&gt;
&lt;P&gt;for exampe:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc univariate data =sashelp.cars noprint;
var invoice;
output out=outdata PCTLPTS = 5 to 100 by 5  PCTLPRE = P;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My question;&lt;/P&gt;
&lt;P&gt;Let's say that I want to know what percentile is value 50000.&lt;/P&gt;
&lt;P&gt;How can I answer it via sas code please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 10:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-what-percentile-located-specific-value/m-p/944053#M369951</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-09-16T10:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: In what percentile located specific value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-what-percentile-located-specific-value/m-p/944054#M369952</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc rank data=sashelp.cars out=cars_ranks percent;
var invoice;
ranks invoice_r;
run;

proc sort data=cars_ranks;
    by invoice;
run;

data want;
    set cars_ranks;
    prev_invoice=lag(invoice);
    if prev_invoice&amp;lt;50000 and invoice&amp;gt;=50000 then output;
    keep invoice invoice_r;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So 50000 is percentile 91.589 (rounded-off to 3 decimal places).&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 12:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-what-percentile-located-specific-value/m-p/944054#M369952</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-09-16T12:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: In what percentile located specific value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-what-percentile-located-specific-value/m-p/944154#M369979</link>
      <description>&lt;P&gt;In addition to the proc rank approach, there is a straightforward data step approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set sashelp.cars (keep=invoice) end=end_of_data;
  array freqs {-1:1} _temporary_ (3*0);
  freqs{sign(invoice-50000)}+1;

  if end_of_data;
  pctile_50000 = freqs{-1} / sum(of freqs{*});
  put pctile_50000=percent10.4;  
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Sep 2024 20:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-what-percentile-located-specific-value/m-p/944154#M369979</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-09-16T20:36:13Z</dc:date>
    </item>
  </channel>
</rss>

