<?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: Proc univariate: save value of 99th percentile in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-univariate-save-value-of-99th-percentile/m-p/293250#M59974</link>
    <description>Hi:&lt;BR /&gt;  The SAS Documentation for PROC UNIVARIATE seems to have a relevant example on how to save percentiles into an output dataset:&lt;BR /&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/procstat/67528/HTML/default/viewer.htm#procstat_univariate_examples08.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/procstat/67528/HTML/default/viewer.htm#procstat_univariate_examples08.htm&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;And then, once you have the percentiles in an output dataset, you could make macro variables that can be used in subsequent steps.&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
    <pubDate>Mon, 22 Aug 2016 20:14:52 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2016-08-22T20:14:52Z</dc:date>
    <item>
      <title>Proc univariate: save value of 99th percentile</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-univariate-save-value-of-99th-percentile/m-p/293247#M59973</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to obtain a numerical value for the 99th percentile to use later in a data step. I think it can be done in a number of ways, but ulitmately I am winsorizing my cohort. I.e., for anyone with costs greater than the 99th percentile, set their cost equal to the 99th percentile value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what i have so far: &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc univariate data = mydata;&lt;BR /&gt;where age_18 = 1;&lt;BR /&gt;class &amp;amp;var1;&lt;BR /&gt;var cost;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;/* --&amp;gt; I want out output the 1st and 99th percentile&amp;nbsp;&lt;EM&gt;values.&amp;nbsp;&lt;/EM&gt;Where do I "output" this value? I dont necessarily need a whole data set, just 1 number.*/&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data mydata2;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set mydata;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if cost &amp;gt; {99th percentile value} then cost_2 = {99th percentile value};&amp;nbsp;&lt;/P&gt;&lt;P&gt;if cost &amp;lt; {1st percentile value} then cost_2 = {1st percentile value;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 20:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-univariate-save-value-of-99th-percentile/m-p/293247#M59973</guid>
      <dc:creator>ly2105</dc:creator>
      <dc:date>2016-08-22T20:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc univariate: save value of 99th percentile</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-univariate-save-value-of-99th-percentile/m-p/293250#M59974</link>
      <description>Hi:&lt;BR /&gt;  The SAS Documentation for PROC UNIVARIATE seems to have a relevant example on how to save percentiles into an output dataset:&lt;BR /&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/procstat/67528/HTML/default/viewer.htm#procstat_univariate_examples08.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/procstat/67528/HTML/default/viewer.htm#procstat_univariate_examples08.htm&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;And then, once you have the percentiles in an output dataset, you could make macro variables that can be used in subsequent steps.&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Mon, 22 Aug 2016 20:14:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-univariate-save-value-of-99th-percentile/m-p/293250#M59974</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-08-22T20:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc univariate: save value of 99th percentile</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-univariate-save-value-of-99th-percentile/m-p/293434#M59981</link>
      <description>&lt;P&gt;As Cynthia says, use the OUTPUT statement and specify the P1= and P99= keywords:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc univariate data=sashelp.cars noprint;
class origin;
var MPG_City;
output out=PctlOut P1=P1 P99=P99;
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could also use PROC MEANS with the same syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have multiple variables, see the article &lt;A href="http://blogs.sas.com/content/iml/2013/10/23/percentiles-in-a-tabular-format.html" target="_self"&gt;"Output percentiles of multiple variables in a tabular format."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 14:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-univariate-save-value-of-99th-percentile/m-p/293434#M59981</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-08-23T14:03:09Z</dc:date>
    </item>
  </channel>
</rss>

