<?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: PCLT of data in colum using SAS guide in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532605#M145952</link>
    <description>&lt;P&gt;Avoid coding all in uppercase, and there is a code window above the post area - {i}.&amp;nbsp; With this you can get output like:&lt;/P&gt;
&lt;PRE&gt;proc means data=sorttemptablesorted;
  var cust;
  by class;
  output out=want  p99=p99;  /* Specify list of calculations here */
run;&lt;/PRE&gt;
&lt;P&gt;So you get an output dataset by using the output out=, or you can also select specific sections of outputs first by running:&lt;/P&gt;
&lt;PRE&gt;ods trace on;

...yourcode...

ods trace off;&lt;/PRE&gt;
&lt;P&gt;This will show in the log or output what elements are created by the procedure, you can then select these like (say I want means output to be saved to want):&lt;/P&gt;
&lt;PRE&gt;ods output means=want;

...your code...&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Feb 2019 16:02:20 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2019-02-04T16:02:20Z</dc:date>
    <item>
      <title>PCLT of data in colum using SAS guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532588#M145948</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I'm trying to calculate the 98th percentil of a data in a colum by&amp;nbsp;two variables. I'm doing this in SAS guide, so building a small programm could be the solution. This is what 've donne base in sas code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SORT&lt;BR /&gt;&amp;nbsp;DATA=WORK.TABLE_1 (KEEP=Cost Class)&lt;BR /&gt;&amp;nbsp;OUT=WORK.SORTTempTableSorted&lt;BR /&gt;&amp;nbsp;;&lt;BR /&gt;&amp;nbsp;BY Class;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC MEANS DATA=WORK.SORTTempTableSorted&amp;nbsp;&lt;/P&gt;&lt;P&gt;P99&amp;nbsp;; (here I would like to be able to chose pe 87%)&lt;BR /&gt;&amp;nbsp;VAR Cust;&lt;BR /&gt;&amp;nbsp;BY Class;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this&amp;nbsp;is not in I table were a can resuse the values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried to do directly in a query with a calculaed field PCTL(87%, Cost) but the result is a table with one colum and as may lines as&amp;nbsp;the original tabel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does&amp;nbsp;someone knows how to&amp;nbsp;get this values?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 15:36:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532588#M145948</guid>
      <dc:creator>AnaC</dc:creator>
      <dc:date>2019-02-04T15:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: PCLT of data in colum using SAS guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532601#M145951</link>
      <description>&lt;P&gt;You may want to look at Proc Univariate and the PCTLPTS option to get different percentile points than Proc Means supports.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or show the code you attempted that did "I also tried to do directly in a query with a calculaed field PCTL(87%, Cost) but the result is a table with one colum and as may lines as&amp;nbsp;the original table."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which sounds like you may have tried something with Proc SQL, missing a Group clause and not including your Cust variable on the select.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 15:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532601#M145951</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-02-04T15:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: PCLT of data in colum using SAS guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532605#M145952</link>
      <description>&lt;P&gt;Avoid coding all in uppercase, and there is a code window above the post area - {i}.&amp;nbsp; With this you can get output like:&lt;/P&gt;
&lt;PRE&gt;proc means data=sorttemptablesorted;
  var cust;
  by class;
  output out=want  p99=p99;  /* Specify list of calculations here */
run;&lt;/PRE&gt;
&lt;P&gt;So you get an output dataset by using the output out=, or you can also select specific sections of outputs first by running:&lt;/P&gt;
&lt;PRE&gt;ods trace on;

...yourcode...

ods trace off;&lt;/PRE&gt;
&lt;P&gt;This will show in the log or output what elements are created by the procedure, you can then select these like (say I want means output to be saved to want):&lt;/P&gt;
&lt;PRE&gt;ods output means=want;

...your code...&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Feb 2019 16:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532605#M145952</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-04T16:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: PCLT of data in colum using SAS guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532614#M145956</link>
      <description>&lt;P&gt;also have a look at this blog&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2013/10/23/percentiles-in-a-tabular-format.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2013/10/23/percentiles-in-a-tabular-format.html&lt;/A&gt; by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 16:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532614#M145956</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2019-02-04T16:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: PCLT of data in colum using SAS guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532623#M145960</link>
      <description>&lt;P&gt;Thank you so much. Combining all your anserws I come up with this code that work perfectly with&amp;nbsp; what I need:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SORT&lt;BR /&gt;&amp;nbsp;DATA=WORK.SIN_C_DIAS_ITA_ITP(KEEP=Cost Class Type)&lt;BR /&gt;&amp;nbsp;OUT=WORK.SORTTempTableSorted&lt;BR /&gt;&amp;nbsp;;&lt;BR /&gt;&amp;nbsp;BY Class Type;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC univariate&amp;nbsp; DATA=WORK.SORTTempTableSorted noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;VAR Costo;&lt;BR /&gt;&amp;nbsp;BY Class Type;&lt;/P&gt;&lt;P&gt;&amp;nbsp;output out=Percentil pctlpre=Class_ pctlpts=98;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;drop table SORTTempTableSorted;&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 16:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/532623#M145960</guid>
      <dc:creator>AnaC</dc:creator>
      <dc:date>2019-02-04T16:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: PCLT of data in colum using SAS guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/533068#M146113</link>
      <description>&lt;P&gt;You can simplify this a bit, especially if your data is small. Is your variable cost or costo? You seem to refer to both?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC univariate  DATA=WORK.SIN_C_DIAS_ITA_ITP(KEEP=Cost Class Type) &lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#800080"&gt;NWAY&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt; noprint;
&lt;FONT size="4" color="#800080"&gt;&lt;STRONG&gt;CLASS&lt;/STRONG&gt;&lt;/FONT&gt; Class Type;
Var Cost;
 output out=Percentil pctlpre=Class_ pctlpts=98;
run; quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To avoid sorting you can use a CLASS statement instead of BY, and add the NWAY option to get only the highest levels of combinations. Remove it to see what you get instead if interested.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Changes are in purple.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/239797"&gt;@AnaC&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you so much. Combining all your anserws I come up with this code that work perfectly with&amp;nbsp; what I need:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SORT&lt;BR /&gt;&amp;nbsp;DATA=WORK.SIN_C_DIAS_ITA_ITP(KEEP=Cost Class Type)&lt;BR /&gt;&amp;nbsp;OUT=WORK.SORTTempTableSorted&lt;BR /&gt;&amp;nbsp;;&lt;BR /&gt;&amp;nbsp;BY Class Type;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC univariate&amp;nbsp; DATA=WORK.SORTTempTableSorted noprint;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;VAR Costo;&lt;BR /&gt;&amp;nbsp;BY Class Type;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;output out=Percentil pctlpre=Class_ pctlpts=98;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;/P&gt;
&lt;P&gt;drop table SORTTempTableSorted;&lt;/P&gt;
&lt;P&gt;Quit;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 20:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PCLT-of-data-in-colum-using-SAS-guide/m-p/533068#M146113</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-05T20:28:31Z</dc:date>
    </item>
  </channel>
</rss>

