<?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: How do I Calculate Percentiles for Non-Numeric data in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/563185#M27809</link>
    <description>Good morning SAS Super FREQ&lt;BR /&gt;&lt;BR /&gt;The first part of the solution gave some clue. Thank you for the quick response&lt;BR /&gt;Regards&lt;BR /&gt;MMohotsi</description>
    <pubDate>Mon, 03 Jun 2019 06:19:29 GMT</pubDate>
    <dc:creator>mmohotsi</dc:creator>
    <dc:date>2019-06-03T06:19:29Z</dc:date>
    <item>
      <title>How do I Calculate Percentiles for Non-Numeric data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/562800#M27801</link>
      <description>&lt;P&gt;Good morning all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a censored data set as below and would like to calculate the 50th, 93rd, 95th and 99th percentiles. The data below has even count and may vary at times to an odd count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS 9.4 and Enterprise Guide 7.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Aluminium;&lt;BR /&gt;input Name $ Result $;&lt;BR /&gt;cards;&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al &amp;lt;15&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al 28&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al &lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt;&lt;BR /&gt;Al &amp;lt;12&lt;BR /&gt;Al &amp;lt;19&lt;BR /&gt;Al &amp;lt;2&lt;BR /&gt;Al &amp;lt;12&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al &amp;lt;15&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al 25&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al &lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt;&lt;BR /&gt;Al &amp;lt;12&lt;BR /&gt;Al &amp;lt;19&lt;BR /&gt;Al &amp;lt;2&lt;BR /&gt;Al &amp;lt;12&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al &amp;lt;15&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al 28&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al &lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt;&lt;BR /&gt;Al &amp;lt;12&lt;BR /&gt;Al &amp;lt;19&lt;BR /&gt;Al &amp;lt;2&lt;BR /&gt;Al &amp;lt;12&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al &amp;lt;15&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al 25&lt;BR /&gt;Al &amp;lt;5&lt;BR /&gt;Al &lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt;&lt;BR /&gt;Al &amp;lt;12&lt;BR /&gt;Al &amp;lt;19&lt;BR /&gt;Al &amp;lt;2&lt;BR /&gt;Al &amp;lt;12&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 08:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/562800#M27801</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2019-05-31T08:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Calculate Percentiles for Non-Numeric data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/562817#M27802</link>
      <description>&lt;P&gt;I think you can do this by using survival analysis, but I am not an expert in that area. You need to create a binary indicator variable that specifies whether the time was observed or censored. You then create a numerical value from the remaining part of the Result string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
set Aluminium;
censored = (substr(Result, 1,1)='&amp;lt;');
w = scan(Result, -1, "&amp;lt;");  /* scans from the right */
t = input(w, best.);
drop w;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;After you get the data in this form, &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_lifetest_toc.htm&amp;amp;locale=en" target="_self"&gt;look at PROC LIFETEST&lt;/A&gt; to analyze the data. For example, the following basic analysis give the 25th, 50th, and 75th percentiles of the survival time.&amp;nbsp; I do not know the options to get a table of the percentiles that you want, although you can read it off the graph of the survival probability:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on;
proc lifetest data=B;
time t*Censored(1);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 11:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/562817#M27802</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-05-31T11:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Calculate Percentiles for Non-Numeric data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/562899#M27805</link>
      <description>The main problem is that you don't really have a defined point in time, it's more a step type function? I would start by doing a PROC FREQ to get the counts of each level. The percentiles will be based on the frequency table cumulative percents. &lt;BR /&gt;&lt;BR /&gt;You could try a censored approach, but I think in this case the math will work out the same.</description>
      <pubDate>Fri, 31 May 2019 16:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/562899#M27805</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-31T16:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Calculate Percentiles for Non-Numeric data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/562935#M27808</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;The main problem is that you don't really have a defined point in time, it's more a step type function? I would start by doing a PROC FREQ to get the counts of each level. The percentiles will be based on the frequency table cumulative percents. &lt;BR /&gt;&lt;BR /&gt;You could try a censored approach, but I think in this case the math will work out the same.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But if you want your result to be a particular order you may need to modify values as &amp;lt;10 will come before &amp;lt;5 when using character values. And the mix of &amp;lt; and integer is very problematic.&lt;/P&gt;
&lt;P&gt;Consider the following proc freq output from your example data step:&lt;/P&gt;
&lt;PRE&gt;                                   Cumulative    Cumulative
Result    Frequency     Percent     Frequency      Percent
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
25               2        5.00             2         5.00
28               2        5.00             4        10.00
&amp;lt;12              8       20.00            12        30.00
&amp;lt;15              4       10.00            16        40.00
&amp;lt;19              4       10.00            20        50.00
&amp;lt;2               4       10.00            24        60.00
&amp;lt;3               4       10.00            28        70.00
&amp;lt;5              12       30.00            40       100.00


&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 May 2019 17:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/562935#M27808</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-31T17:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Calculate Percentiles for Non-Numeric data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/563185#M27809</link>
      <description>Good morning SAS Super FREQ&lt;BR /&gt;&lt;BR /&gt;The first part of the solution gave some clue. Thank you for the quick response&lt;BR /&gt;Regards&lt;BR /&gt;MMohotsi</description>
      <pubDate>Mon, 03 Jun 2019 06:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/563185#M27809</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2019-06-03T06:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Calculate Percentiles for Non-Numeric data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/563224#M27817</link>
      <description>Good day&lt;BR /&gt;&lt;BR /&gt;I think the challenge with this approach is the order of the field "Result'. Combining the response from Rick_SAS and the two latest might have a light at the end of the tunnel.</description>
      <pubDate>Mon, 03 Jun 2019 10:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-Calculate-Percentiles-for-Non-Numeric-data/m-p/563224#M27817</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2019-06-03T10:53:07Z</dc:date>
    </item>
  </channel>
</rss>

