<?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: Summary statistics table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Summary-statistics-table/m-p/800055#M314673</link>
    <description>&lt;P&gt;If you want multiple percentiles for multiple variables see the following. Either of the Pcntlpre statements will work.&lt;BR /&gt;The key bit you were missing is PCNTLPRE, as in a prefix to put before things, especially when really wanting multiple percentiles. The list options a pretty limited. However I would not recommend the simple v0-v5 list if you are asking for many percentiles for many variables as it can get hard to tell where a base variable name ends and the percentile value starts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc univariate data=have noprint;
   var v0-v5;
   output out=stat_2 
   pctlpts= 15 30
   pctlpre = v0 - v5 
/*   pctlpre = Pv0_ Pv1_ Pv2_ Pv3_ Pv4_ Pv5_ */
   ;
run;&lt;/PRE&gt;
&lt;P&gt;If you don't really need P15 or P85 you might look at this output from Proc tabulate:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=have;
  var  v0-v5;
  table mean median p1 p10 p80 p90 p99 ,
        v0-v1
  ;
run;&lt;/PRE&gt;
&lt;P&gt;Unfortunately Tabulate only does 1, 5, 10 to 90 by 10, 95 and 99 percentiles&amp;nbsp; and the quartiles ( q1=P25, q3 = P75)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Mar 2022 04:06:52 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-03-04T04:06:52Z</dc:date>
    <item>
      <title>Summary statistics table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summary-statistics-table/m-p/800036#M314658</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want to create a table where each column is a variable.&lt;/P&gt;
&lt;P&gt;Rows are Mean, Median, percentile 15, percentile 85, percentile x.&lt;/P&gt;
&lt;P&gt;For mean and median, I can do it as below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when it come to percentile, I can't specify the output name as for mean and median so I am kind of stuck.&lt;/P&gt;
&lt;P&gt;Can you please help?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input v0 v1 v2 v3 v4 v5;
datalines;
1 1 0 5 6 0
1 1 0 5 7 1
2 1 0 5 7 0
4 1 1 5 6 1
5 1 0 5 6 0
6 1 1 5 9 0
7 1 0 5 2 -1
8 2 1 5 4 -1
9 2 1 5 1 0
;run;


proc univariate data=have noprint;
var v0-v5;
output out=stat_1 
mean=v0-v5;run;
data stat_1; set stat_1;
statistic = 'MEAN';run;

proc univariate data=have noprint;
var v0-v5;
output out=stat_2 
median=v0-v5;run;
data stat_2; set stat_2;
statistic = 'MEDIAN';run;

*I can stack one on top of the other as name are the same;
data summary; set stat_1 stat_2;run;


proc univariate data=have noprint;
var v0-v5;
output out=stat_2 
pctlpts= 15
pctlname=v0-v5; *this doesn't work;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 02:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summary-statistics-table/m-p/800036#M314658</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2022-03-04T02:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Summary statistics table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summary-statistics-table/m-p/800055#M314673</link>
      <description>&lt;P&gt;If you want multiple percentiles for multiple variables see the following. Either of the Pcntlpre statements will work.&lt;BR /&gt;The key bit you were missing is PCNTLPRE, as in a prefix to put before things, especially when really wanting multiple percentiles. The list options a pretty limited. However I would not recommend the simple v0-v5 list if you are asking for many percentiles for many variables as it can get hard to tell where a base variable name ends and the percentile value starts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc univariate data=have noprint;
   var v0-v5;
   output out=stat_2 
   pctlpts= 15 30
   pctlpre = v0 - v5 
/*   pctlpre = Pv0_ Pv1_ Pv2_ Pv3_ Pv4_ Pv5_ */
   ;
run;&lt;/PRE&gt;
&lt;P&gt;If you don't really need P15 or P85 you might look at this output from Proc tabulate:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=have;
  var  v0-v5;
  table mean median p1 p10 p80 p90 p99 ,
        v0-v1
  ;
run;&lt;/PRE&gt;
&lt;P&gt;Unfortunately Tabulate only does 1, 5, 10 to 90 by 10, 95 and 99 percentiles&amp;nbsp; and the quartiles ( q1=P25, q3 = P75)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 04:06:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summary-statistics-table/m-p/800055#M314673</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-03-04T04:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Summary statistics table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summary-statistics-table/m-p/800060#M314677</link>
      <description>&lt;P&gt;Thank you for your help.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 04:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summary-statistics-table/m-p/800060#M314677</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2022-03-04T04:36:22Z</dc:date>
    </item>
  </channel>
</rss>

