<?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: Number of observations in specific percentile in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856814#M338531</link>
    <description>&lt;P&gt;Another explanation that is inconsistent with earlier explanations. Now you seem to be saying something different. Now it seems you are saying you want the proportion LESS THAN p5 (if I am understanding you properly) — and its still not clear what you want for P10, P25, ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are the percentiles computed separately for males and females? Or are they computed across the entire population and then this percentile is applied to the males and applied to the females&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 11:20:59 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-02-02T11:20:59Z</dc:date>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856734#M338497</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;Hello,&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I need to calculate # of observations for specific percentiles of below:&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;proc univariate data=myData noprint;
    by year sex;
    weight myWeight;
    var wage;
    output out=myNewData PCTLPTS= 1 5 10 25 75 90 95 99&lt;BR /&gt;                         PCTLPRE= PER_;
run; &lt;BR /&gt;&lt;BR /&gt;Data Total; &lt;BR /&gt;  merge myData myNewData; &lt;BR /&gt;  by year sex;&lt;BR /&gt;    array pct(*) per:;&lt;BR /&gt;    do i=1 to dim(pct);&lt;BR /&gt;    if pct(i-1) &amp;lt;=wage &amp;lt;= pct(i) then index = i-1; end; drop per; run; &lt;BR /&gt;&lt;BR /&gt;proc freq data= total; tables sex* year* index * (var1 var2); weight myweight; run; &lt;/PRE&gt;&lt;P&gt;But I have 7 index instead of 8 index.&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I appreciate your help.&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 Feb 2023 20:11:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856734#M338497</guid>
      <dc:creator>altadata1</dc:creator>
      <dc:date>2023-02-01T20:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856736#M338499</link>
      <description>&lt;P&gt;I don't understand the question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to calculate the percent in percentile 1 and the percent in percentile 5 and the percent in percentile 25 and so on?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;Do you want to calculate the percent between percentile 1 and percentile 5, and the percent between percentile 5 and percentile 25 and so on?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have a lot of ties in your data in variable wage? Could the use of the weight statement produce lots of ties, meaning uneven distribution of observations to percentile?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 20:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856736#M338499</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-01T20:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856740#M338502</link>
      <description>&lt;P&gt;Thank you for the response PageMiller.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to calculate the proportion of observations for each PI, P5, P10.... P99 by sex year Var1 and Var2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does it answer your question?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 20:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856740#M338502</guid>
      <dc:creator>altadata1</dc:creator>
      <dc:date>2023-02-01T20:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856744#M338505</link>
      <description>&lt;P&gt;Your code as shown is calculating the number of observations (not weighted correctly) between the percentiles , ie less than 1, between 1 and 5 etc. &lt;BR /&gt;&lt;BR /&gt;What do you want to accomplish? Also, wouldn't that do loop error out as it goes from p-1/i-1 which is undefined?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 21:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856744#M338505</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-02-01T21:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856749#M338507</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/220658"&gt;@altadata1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for the response PageMiller.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to calculate the proportion of observations for each PI, P5, P10.... P99 by sex year Var1 and Var2.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does it answer your question?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It seems to answer the question, but it leaves me thinking that this is a relatively meaningless thing to do. I am mystified by the request. Can you tell me why you want the proportion of observations at P1 and proportion at P5 but not at P4? What benefit is there to knowing how many values are at P5?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to know the proportion at &lt;FONT color="#FF0000"&gt;exactly&lt;/FONT&gt; percentile 5, what about the proportion at P4.9 and P5.1, are those considered to be P5??&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 21:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856749#M338507</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-01T21:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856756#M338510</link>
      <description>&lt;P&gt;Thank you for the reply Reeza.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset as mydata contents sex year wage weight var1 and var2. I need to calculate weighted P1, P5, P10... P99 for wage. Then, I would like to estimate the proportions of observations fall into each percentile disaggregated by sex year var1 and var2, like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sex&amp;nbsp; &amp;nbsp; &amp;nbsp;year&amp;nbsp; &amp;nbsp; var1&amp;nbsp; &amp;nbsp; &amp;nbsp;var2&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;P1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2007&amp;nbsp; &amp;nbsp; &amp;nbsp;X%&amp;nbsp; &amp;nbsp; &amp;nbsp; Y%&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;P5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;P10&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;P99&lt;/P&gt;&lt;P&gt;X% or Y%: proportion&amp;nbsp; in P1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 22:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856756#M338510</guid>
      <dc:creator>altadata1</dc:creator>
      <dc:date>2023-02-01T22:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856757#M338511</link>
      <description>&lt;P&gt;That's kind of a weird request because it's 1% fall in the 1th percentile, 5% fall under the P5 ( or 4% between P1/P5)....&lt;/P&gt;
&lt;P&gt;That's the definition of percentiles.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 22:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856757#M338511</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-02-01T22:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856809#M338529</link>
      <description>&lt;P&gt;That's right Reeza. P5 here, for example, is the value of wage that&amp;nbsp; 5% of observations fall in this value or below that. Now, I need to know from this 5% what proportion&amp;nbsp;is,&amp;nbsp; for example, women, were paid those wages in year=2000, have bachelor degree (var 1) and are married (Var 2). For this. I need to know the number of observation for each P1, P5, P10... P99. Then do&amp;nbsp; cross tabulation with the variables. Am I right?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 10:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856809#M338529</guid>
      <dc:creator>altadata1</dc:creator>
      <dc:date>2023-02-02T10:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856810#M338530</link>
      <description>&lt;P&gt;Thank you PageMiller. Here is what I need to do:&lt;/P&gt;&lt;P&gt;P5 here, for example, is the value of wage that&amp;nbsp; 5% of observations fall in this value or below that. Now, I need to know from this 5% what proportion&amp;nbsp;is,&amp;nbsp; for example, women, were paid those wages in year=2000, have bachelor degree (var 1) and are married (Var 2). For this. I need to know the number of observation for each P1, P5, P10... P99. Then do&amp;nbsp; cross tabulation with the variables. Am I right?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 10:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856810#M338530</guid>
      <dc:creator>altadata1</dc:creator>
      <dc:date>2023-02-02T10:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856814#M338531</link>
      <description>&lt;P&gt;Another explanation that is inconsistent with earlier explanations. Now you seem to be saying something different. Now it seems you are saying you want the proportion LESS THAN p5 (if I am understanding you properly) — and its still not clear what you want for P10, P25, ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are the percentiles computed separately for males and females? Or are they computed across the entire population and then this percentile is applied to the males and applied to the females&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 11:20:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856814#M338531</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-02T11:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in specific percentile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856817#M338533</link>
      <description>&lt;P&gt;@PageMiller. Thank you for your time and help, but I don't think I've ever been inconsistent. Please refer to my first post.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mentioned from the beginning that I have P1 P5 P10 P25 P75 P90 P95 and P99 and I would like to calculate the number of observation within&amp;nbsp; each percentile.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 12:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Number-of-observations-in-specific-percentile/m-p/856817#M338533</guid>
      <dc:creator>altadata1</dc:creator>
      <dc:date>2023-02-02T12:07:19Z</dc:date>
    </item>
  </channel>
</rss>

