<?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 tabulate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/655773#M196728</link>
    <description>&lt;P&gt;Thank you for using a SAS supplied data set we can run code.&lt;/P&gt;
&lt;P&gt;Tabulate does not do sums of different variables. You would need Proc report for that .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc report data=sashelp.class;
   column sex age height tot totpct ;
   define sex /group;
   define age / sum;
   define height/ sum;
   define tot /Computed "Total";
   define totpct/Computed format=percent8.1;
   compute tot;
      tot = age.sum +height.sum;
   endcomp;
   compute totpct;
      totpct = age.sum/(age.sum+height.sum);
   endcomp;
   rbreak after/summarize;
run;&lt;/PRE&gt;
&lt;P&gt;Or use proc summary to summarize the age and height by sex in a data step first and precalculate the row summaries. Note that Proc summary will provide an overall summary.&lt;/P&gt;
&lt;PRE&gt;proc summary data=sashelp.class;
   class sex;
   var age height;
   output out=work.summary sum=;
run;&lt;/PRE&gt;
&lt;P&gt;The _type_ variable in the output data indicates which combinations of the class variables appear. You could use this in a data step to calculate the sum of age and height plus the desired percent for each row.&lt;/P&gt;
&lt;P&gt;Then use Proc Print to display the result.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2020 01:49:55 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-06-10T01:49:55Z</dc:date>
    <item>
      <title>proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/655671#M196717</link>
      <description>&lt;P&gt;hi i am looking to get total of two variables in seprate column like as shown in below format . also looking to get age/total %.&amp;nbsp; can anyone help please thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC TABULATE data=sashelp.class  missing format=comma29.;
class  sex;
var age height;
table sex ='eligible/ineligible' all = 'Total', all='Tota' (age height )*SUM=''/box='DATA' ;

run;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tabulate.PNG" style="width: 433px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/41605i97B5F2CC403B5479/image-size/large?v=v2&amp;amp;px=999" role="button" title="tabulate.PNG" alt="tabulate.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 00:36:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/655671#M196717</guid>
      <dc:creator>parneet01</dc:creator>
      <dc:date>2020-06-10T00:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/655773#M196728</link>
      <description>&lt;P&gt;Thank you for using a SAS supplied data set we can run code.&lt;/P&gt;
&lt;P&gt;Tabulate does not do sums of different variables. You would need Proc report for that .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc report data=sashelp.class;
   column sex age height tot totpct ;
   define sex /group;
   define age / sum;
   define height/ sum;
   define tot /Computed "Total";
   define totpct/Computed format=percent8.1;
   compute tot;
      tot = age.sum +height.sum;
   endcomp;
   compute totpct;
      totpct = age.sum/(age.sum+height.sum);
   endcomp;
   rbreak after/summarize;
run;&lt;/PRE&gt;
&lt;P&gt;Or use proc summary to summarize the age and height by sex in a data step first and precalculate the row summaries. Note that Proc summary will provide an overall summary.&lt;/P&gt;
&lt;PRE&gt;proc summary data=sashelp.class;
   class sex;
   var age height;
   output out=work.summary sum=;
run;&lt;/PRE&gt;
&lt;P&gt;The _type_ variable in the output data indicates which combinations of the class variables appear. You could use this in a data step to calculate the sum of age and height plus the desired percent for each row.&lt;/P&gt;
&lt;P&gt;Then use Proc Print to display the result.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 01:49:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/655773#M196728</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-10T01:49:55Z</dc:date>
    </item>
  </channel>
</rss>

