<?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 to calculate the percentile across observations in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256081#M13521</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Data A;
  Length ID $10.;
  Do i=1 To 1000;
    ID=Catt('Bank_',Put(i,Z4.));
	Value=Int(Ranuni(1)*1000);
	Output;
  End;
  Drop i;
Run;

Proc Univariate Data=A NoPrint;
  Var Value;
  Output Out=Result PctlPre=PERC_ PctlPts=1 to 100 by 1; 
Run;

Data B (Keep=ID Value Info);
  Length Info $20.;
  Set A;
  If _N_ eq 1 Then Do;
    Set Result;
  End;
  Array P Perc_:;
  Do i=1 To Dim(P);
    If Missing (Info) &amp;amp; Value lt P[i] Then Info=VName(P[i]);
  End;
Run;

* .. only to check;
Proc Sort Data=B;
  By Value;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Mar 2016 11:56:33 GMT</pubDate>
    <dc:creator>user24feb</dc:creator>
    <dc:date>2016-03-11T11:56:33Z</dc:date>
    <item>
      <title>Proc univariate to calculate the percentile across observations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256064#M13516</link>
      <description>&lt;P&gt;Dear SAS users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling a bit on calculating&amp;nbsp; the percentiles across observations using a proc univariate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dataset is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; V1&amp;nbsp;&amp;nbsp; v2&amp;nbsp;&amp;nbsp; v3 PercentileV1 Percentile V2 Percentile V3&lt;/P&gt;&lt;P&gt;Bank1&lt;/P&gt;&lt;P&gt;Bank2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to created the variables Percentilve V1, V2 and V3 for a defined population of banks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone has used the proc univariate to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In advance, thanks a lot,&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 10:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256064#M13516</guid>
      <dc:creator>Tanguy</dc:creator>
      <dc:date>2016-03-11T10:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc univariate to calculate the percentile across observations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256066#M13517</link>
      <description>&lt;P&gt;For data in wide form (each bank in its own variable), 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;contains your answer. It shows how to use PROC MEANS (near top) and PROC UNIVARIATE (scroll down).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For data in long for (banks identified by the value of a categorical variable), you can use the CLASS statement as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=sashelp.class p25 p50 p75;;
class sex;
var height;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 11:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256066#M13517</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-03-11T11:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc univariate to calculate the percentile across observations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256069#M13518</link>
      <description>&lt;P&gt;You could search for the pctlpts-option: &lt;A href="http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_univariate_sect063.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_univariate_sect063.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I think the result should bel like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data A;
  Do ID='BANK1','BANK2','BANK3';
    Do j=0 To 100;
	  Output;
    End;
  End;
Run;

Proc Univariate Data=A NoPrint;
  Var j;
  By ID;
  Output Out=Result PctlPre=PERC_ PctlPts=30, 70 to 85 by 5; 
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Mar 2016 11:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256069#M13518</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2016-03-11T11:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc univariate to calculate the percentile across observations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256070#M13519</link>
      <description>Dear,&lt;BR /&gt;That is interesting indeed, thanks a lot!&lt;BR /&gt;Actually the value of the PercentileV1, V2, V3 should be the interval where the bank stands e.g. Bank1 stands between 56th and 57th percentile.&lt;BR /&gt;Do you have any idea how to tackle this?&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Mar 2016 11:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256070#M13519</guid>
      <dc:creator>Tanguy</dc:creator>
      <dc:date>2016-03-11T11:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc univariate to calculate the percentile across observations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256072#M13520</link>
      <description>Dear,&lt;BR /&gt;That is interesting indeed, thanks a lot!&lt;BR /&gt;Actually the value of the PercentileV1, V2, V3 should be the interval where the bank stands e.g. Bank1 stands between 56th and 57th percentile.&lt;BR /&gt;I was not very clear in my question.&lt;BR /&gt;Do you have any idea how to tackle this?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Mar 2016 11:16:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256072#M13520</guid>
      <dc:creator>Tanguy</dc:creator>
      <dc:date>2016-03-11T11:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc univariate to calculate the percentile across observations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256081#M13521</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Data A;
  Length ID $10.;
  Do i=1 To 1000;
    ID=Catt('Bank_',Put(i,Z4.));
	Value=Int(Ranuni(1)*1000);
	Output;
  End;
  Drop i;
Run;

Proc Univariate Data=A NoPrint;
  Var Value;
  Output Out=Result PctlPre=PERC_ PctlPts=1 to 100 by 1; 
Run;

Data B (Keep=ID Value Info);
  Length Info $20.;
  Set A;
  If _N_ eq 1 Then Do;
    Set Result;
  End;
  Array P Perc_:;
  Do i=1 To Dim(P);
    If Missing (Info) &amp;amp; Value lt P[i] Then Info=VName(P[i]);
  End;
Run;

* .. only to check;
Proc Sort Data=B;
  By Value;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 11:56:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256081#M13521</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2016-03-11T11:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc univariate to calculate the percentile across observations</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256085#M13522</link>
      <description>That is absolutely great, thank you!&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Mar 2016 12:07:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-univariate-to-calculate-the-percentile-across-observations/m-p/256085#M13522</guid>
      <dc:creator>Tanguy</dc:creator>
      <dc:date>2016-03-11T12:07:26Z</dc:date>
    </item>
  </channel>
</rss>

