<?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 Means - Customising Output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/362095#M85508</link>
    <description>&lt;P&gt;Provide some data.&lt;/P&gt;
&lt;P&gt;I suspect that Proc Tabulate and/or Proc report could do that quite easily.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A complete guess without data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc tabulate data = have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class country;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class gender;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var income;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; table country,&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;&amp;nbsp; (gender=' ' All='N obs')*n=' ' income=' '*(mean*f=dollar12.2 median*f=dollar12.2 sum*f=dollar16.2);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Fri, 26 May 2017 21:19:18 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-05-26T21:19:18Z</dc:date>
    <item>
      <title>Proc Means - Customising Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/361852#M85399</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need&amp;nbsp;to change the proc means output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the actual output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc &lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;means&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=test &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;mean&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;median&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;sum&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;class&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; countryname&amp;nbsp;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; income ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Country Name&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;N Obs&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Mean&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Median&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Sum&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Algeria&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;TD&gt;$3,676.36&lt;/TD&gt;&lt;TD&gt;$181.94&lt;/TD&gt;&lt;TD&gt;$222,764.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Afghanistan&lt;/TD&gt;&lt;TD&gt;64&lt;/TD&gt;&lt;TD&gt;$18,169.66&lt;/TD&gt;&lt;TD&gt;$6,056.50&lt;/TD&gt;&lt;TD&gt;$119,997.97&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is another variable called Gender, which has male and female. I need the output to be like this showing only the nobs (counts) instead of displaying&amp;nbsp;statistics&amp;nbsp;for male and female. I dont want to include gender in the class variable to avoid the statistics for the male and female.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Country Name&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Male&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Female&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;N Obs&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Mean&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Median&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Sum&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Algeria&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;37&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;TD&gt;$3,676.36&lt;/TD&gt;&lt;TD&gt;$181.94&lt;/TD&gt;&lt;TD&gt;$222,764.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Afghanistan&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;64&lt;/TD&gt;&lt;TD&gt;$18,169.66&lt;/TD&gt;&lt;TD&gt;$6,056.50&lt;/TD&gt;&lt;TD&gt;$119,997.97&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see in this output(Which I need), there is no stats for male and female.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for looking&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2017 03:56:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/361852#M85399</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2017-05-26T03:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means - Customising Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/361857#M85402</link>
      <description>&lt;P&gt;You can't do this via PROC MEANS as far as I know. The easiest alternative is to calculate it externally and merge the data in.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on how complex your report is, you could generate the table in one step in SQL but it's a fairly manual task. And you would need SAS 9.4+ at least.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2017 04:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/361857#M85402</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-26T04:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means - Customising Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/361898#M85429</link>
      <description>&lt;PRE&gt;proc  means data=test mean median sum;
  class countryname ;
  var income ;
  output out=inter;
run;
proc sql;
  create table WANT as
  select  COUNTRYNAME,
          (select count(*) from TEST A where A.COUNTRYNAME=COUNTRYNAME and SEX="MALE") as MALE,
          (select count(*) from TEST A where A.COUNTRYNAME=COUNTRYNAME and SEX="FEMALE") as FEMALE,
          NOBS,
          MEAN,
          MEDIAN,
          SUM
   from   INTER;
quit;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 May 2017 08:12:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/361898#M85429</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-26T08:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means - Customising Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/361939#M85442</link>
      <description>&lt;P&gt;If you have SAS9.4 . Try SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select age,count(*) as n,
 mean(weight) as mean,
 median(weight) as median,
 sum(weight) as sum,
 (select count(*) from sashelp.class where sex='F' and age=a.age) as Female,
 (select count(*) from sashelp.class where sex='M' and age=a.age) as Male

 from sashelp.class as a
  group by age ;
 quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 May 2017 12:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/361939#M85442</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-05-26T12:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means - Customising Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/362095#M85508</link>
      <description>&lt;P&gt;Provide some data.&lt;/P&gt;
&lt;P&gt;I suspect that Proc Tabulate and/or Proc report could do that quite easily.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A complete guess without data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc tabulate data = have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class country;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class gender;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var income;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; table country,&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;&amp;nbsp; (gender=' ' All='N obs')*n=' ' income=' '*(mean*f=dollar12.2 median*f=dollar12.2 sum*f=dollar16.2);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2017 21:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Customising-Output/m-p/362095#M85508</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-26T21:19:18Z</dc:date>
    </item>
  </channel>
</rss>

