<?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 Insert a Row at the end of the data with totals in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136539#M261151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone!&amp;nbsp; Is there any way to insert a row at the end of the data set with the totals? Here it is a sample data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="235"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="113"&gt;DATA&lt;/TD&gt;&lt;TD class="xl63" width="122"&gt;COUNT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 1&lt;/TD&gt;&lt;TD align="right"&gt;23&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 2&lt;/TD&gt;&lt;TD align="right"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 3&lt;/TD&gt;&lt;TD align="right"&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 4&lt;/TD&gt;&lt;TD align="right"&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 5&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 6&lt;/TD&gt;&lt;TD align="right"&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 7&lt;/TD&gt;&lt;TD align="right"&gt;29&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here it is what I want to do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="235"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" width="113"&gt;DATA&lt;/TD&gt;&lt;TD class="xl65" width="122"&gt;COUNT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 1&lt;/TD&gt;&lt;TD align="right"&gt;23&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 2&lt;/TD&gt;&lt;TD align="right"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 3&lt;/TD&gt;&lt;TD align="right"&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 4&lt;/TD&gt;&lt;TD align="right"&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 5&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 6&lt;/TD&gt;&lt;TD align="right"&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 7&lt;/TD&gt;&lt;TD align="right"&gt;29&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;Total&lt;/TD&gt;&lt;TD align="right"&gt;185&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will appreciate any kind of help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Milenko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Jan 2015 20:20:40 GMT</pubDate>
    <dc:creator>MilenkoAndreas</dc:creator>
    <dc:date>2015-01-23T20:20:40Z</dc:date>
    <item>
      <title>Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136539#M261151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone!&amp;nbsp; Is there any way to insert a row at the end of the data set with the totals? Here it is a sample data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="235"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="113"&gt;DATA&lt;/TD&gt;&lt;TD class="xl63" width="122"&gt;COUNT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 1&lt;/TD&gt;&lt;TD align="right"&gt;23&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 2&lt;/TD&gt;&lt;TD align="right"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 3&lt;/TD&gt;&lt;TD align="right"&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 4&lt;/TD&gt;&lt;TD align="right"&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 5&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 6&lt;/TD&gt;&lt;TD align="right"&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17"&gt;DATA 7&lt;/TD&gt;&lt;TD align="right"&gt;29&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here it is what I want to do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="235"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" width="113"&gt;DATA&lt;/TD&gt;&lt;TD class="xl65" width="122"&gt;COUNT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 1&lt;/TD&gt;&lt;TD align="right"&gt;23&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 2&lt;/TD&gt;&lt;TD align="right"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 3&lt;/TD&gt;&lt;TD align="right"&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 4&lt;/TD&gt;&lt;TD align="right"&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 5&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 6&lt;/TD&gt;&lt;TD align="right"&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 7&lt;/TD&gt;&lt;TD align="right"&gt;29&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;Total&lt;/TD&gt;&lt;TD align="right"&gt;185&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will appreciate any kind of help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Milenko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 20:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136539#M261151</guid>
      <dc:creator>MilenkoAndreas</dc:creator>
      <dc:date>2015-01-23T20:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136540#M261152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One example:&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input var $ COUNT;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;DATA1 23&lt;/P&gt;&lt;P&gt;DATA2 35&lt;/P&gt;&lt;P&gt;DATA3 27&lt;/P&gt;&lt;P&gt;DATA4 24&lt;/P&gt;&lt;P&gt;DATA5 25&lt;/P&gt;&lt;P&gt;DATA6 22&lt;/P&gt;&lt;P&gt;DATA7 29&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have end=last;&lt;/P&gt;&lt;P&gt;_ct+count;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if last then&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;var='Total';&lt;/P&gt;&lt;P&gt;Count=_CT;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop _ct;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 20:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136540#M261152</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-01-23T20:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136541#M261153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt; set have;&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; insert into want&lt;/P&gt;&lt;P&gt;&amp;nbsp; select Ttotal' as data,sum(count) as count from have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 20:56:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136541#M261153</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2015-01-23T20:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136542#M261154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why? &lt;/P&gt;&lt;P&gt;If it is just for a report then just have the report generate the totals.&lt;/P&gt;&lt;P&gt;PROC PRINT ...;&lt;/P&gt;&lt;P&gt;&amp;nbsp; VAR DATA COUNT ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SUM COUNT;&lt;/P&gt;&lt;P&gt;RUN:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use PROC SUMMARY (means) to generate totals and PROC APPEND to attach to an existing file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; sashelp.class ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;means&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;noprint&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=class ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=summary &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;append&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=summary &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=class &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;force&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=class ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 23:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136542#M261154</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-01-23T23:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136543#M261155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI:&lt;BR /&gt;I would use PROC REPORT or PROC PRINT for a report like this. For example, using PROC REPORT, see a similar example using SASHELP.CLASS (where I add up the HEIGHT and WEIGHT instead of COUNT).&lt;/P&gt;&lt;P&gt;Cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods html file='c:\temp\Total_Line.html';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title 'Total Line for Students Heights';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc report data=sashelp.class nowd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; style(summary)=Header;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; title 'Proc REPORT';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; column name age sex height weight;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define name / order;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define age / order;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define sex / display;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define height/ sum;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define weight / sum;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; rbreak after / summarize;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; compute after&amp;nbsp; ;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name='Total';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods _all_ close;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jan 2015 02:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136543#M261155</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2015-01-24T02:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136544#M261156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;slchen! Thank you for your answer! Im new in using SAS, and I know very little, I tried your code, and it didnt work...it says that the Ttotal, sum columns dont exist, and that the sum functions needs a numeric value. Here it is the code that Im using:&lt;/P&gt;&lt;P&gt;data WORK.FILA_FINAL_COUNT;&lt;/P&gt;&lt;P&gt;set WORK.query_for_query_final;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; insert into WORK.FILA_FINAL_COUNT&lt;/P&gt;&lt;P&gt;&amp;nbsp; select Ttotal as data,sum(C) as count from WORK.query_for_query_final;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;It would be great if you could tell me what Im doing worng.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings, and thanks again!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Milenko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 13:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136544#M261156</guid>
      <dc:creator>MilenkoAndreas</dc:creator>
      <dc:date>2015-01-26T13:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136545#M261157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai.Kuo! Thank you very much for your answer. Im new in using SAS, so i dont understand very well the code that you are giving me. I foyu could walk me a bit, it would great! I do know what you mean with data want and data have, but the rest is not really understandable for my level of knowledge, which is pretty basic. In any case, I really appreciate for your help!&lt;/P&gt;&lt;P&gt;Greetings!&lt;/P&gt;&lt;P&gt;Milenko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 13:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136545#M261157</guid>
      <dc:creator>MilenkoAndreas</dc:creator>
      <dc:date>2015-01-26T13:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136546#M261158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom! Thank you very much! But I dont want to do a report, I want create another data set. I want to create another data set, and i will keep working with it, applying functions, etc.In any case, I really appreciate your help.!&lt;/P&gt;&lt;P&gt;Greetings!&lt;/P&gt;&lt;P&gt;Milenko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 13:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136546#M261158</guid>
      <dc:creator>MilenkoAndreas</dc:creator>
      <dc:date>2015-01-26T13:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136547#M261159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Cynthia! Thank you so much! But I dont need to do a report.&amp;nbsp; I want to create another data set, and I will keep working with it, applying functions, etc.In any case, I really appreciate your help.!&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Greetings!&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Milenko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 13:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136547#M261159</guid>
      <dc:creator>MilenkoAndreas</dc:creator>
      <dc:date>2015-01-26T13:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136548#M261160</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Editor's Note: &amp;nbsp;Thanks everyone for all of the answers. &amp;nbsp;The SQL one works well. &amp;nbsp;This solution gives a little more flexibility for the number of variables that need to be summed and inserting text for the summary row.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using PROC SUMMARY to generate the total row is the most "SAS like" way to do it.&lt;/P&gt;
&lt;P&gt;If you want to put the string "TOTAL" into one of your character variables so that you can tell which row is the total and which rows are the real data then you would need to add some extra code.&lt;/P&gt;
&lt;P&gt;For example if we assume that SASHELP.CLASS is your input data then these two steps will generate a new dataset named WANT with the totals appended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;means&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;noprint&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=sashelp.class ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=summary &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; sashelp.class summary (in=in2);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; in2 &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; name=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'TOTAL'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 16:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136548#M261160</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-08-30T16:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136549#M261161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;&amp;nbsp; data="data1"; c=2; output;&lt;BR /&gt;&amp;nbsp; data="data2"; c=2; output;&lt;BR /&gt;&amp;nbsp; data="data3"; c=1; output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; create table WANT as&lt;BR /&gt;&amp;nbsp; select&amp;nbsp; *&lt;BR /&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; HAVE&lt;BR /&gt;&amp;nbsp; union all&lt;BR /&gt;&amp;nbsp; select&amp;nbsp; "Total",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(C) as C&lt;BR /&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; HAVE;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 13:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136549#M261161</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-26T13:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136550#M261162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Tom! Thank you so much again! It is really helpful! I tried your code and it worked! But im almost there. The result that I get is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="573"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" width="113"&gt;DATA&lt;/TD&gt;&lt;TD class="xl65" width="122"&gt;COUNT&lt;/TD&gt;&lt;TD class="xl65" width="99"&gt;_TYPE_&lt;/TD&gt;&lt;TD class="xl65" width="166"&gt;_FREQ_&lt;/TD&gt;&lt;TD class="xl65" width="73"&gt;name&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 1&lt;/TD&gt;&lt;TD align="right"&gt;23&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 2&lt;/TD&gt;&lt;TD align="right"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 3&lt;/TD&gt;&lt;TD align="right"&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 4&lt;/TD&gt;&lt;TD align="right"&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 5&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 6&lt;/TD&gt;&lt;TD align="right"&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 7&lt;/TD&gt;&lt;TD align="right"&gt;29&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;-&lt;/TD&gt;&lt;TD align="right"&gt;185&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right"&gt;7&lt;/TD&gt;&lt;TD class="xl65"&gt;Total&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the result that Im looking foward is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="235"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" width="113"&gt;DATA&lt;/TD&gt;&lt;TD class="xl65" width="122"&gt;COUNT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 1&lt;/TD&gt;&lt;TD align="right"&gt;23&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 2&lt;/TD&gt;&lt;TD align="right"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 3&lt;/TD&gt;&lt;TD align="right"&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 4&lt;/TD&gt;&lt;TD align="right"&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 5&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 6&lt;/TD&gt;&lt;TD align="right"&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;DATA 7&lt;/TD&gt;&lt;TD align="right"&gt;29&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;Total&lt;/TD&gt;&lt;TD align="right"&gt;185&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to tweak your code to make it happen?&amp;nbsp; &lt;/P&gt;&lt;P&gt;In any case you already have helped me a lot! Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings!&lt;/P&gt;&lt;P&gt;Milenko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 14:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136550#M261162</guid>
      <dc:creator>MilenkoAndreas</dc:creator>
      <dc:date>2015-01-26T14:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136551#M261163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The extra variables _TYPE_ and _FREQ_ are generated by PROC MEANS.&amp;nbsp; You can remove them with a DROP statement.&lt;/P&gt;&lt;P&gt;The extra variable NAME is because you did not adjust the program to match the variables in your dataset.&amp;nbsp; From your output you want to assign 'Total' to the variable DATA instead of the variable NAME.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 14:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136551#M261163</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-01-26T14:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136552#M261164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry to miss a double quote for "Total";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data WORK.FILA_FINAL_COUNT;&lt;/P&gt;&lt;P&gt;set WORK.query_for_query_final;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; insert into WORK.FILA_FINAL_COUNT&lt;/P&gt;&lt;P&gt;&amp;nbsp; select "Total" as data,sum(C) as count from WORK.query_for_query_final;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 14:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136552#M261164</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2015-01-26T14:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136553#M261165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;slchen, Thank you again! I tried the code and it still has problems with the C parameter: &lt;/P&gt;&lt;P&gt;ERROR: The SUM summary function requires a numeric argument.&lt;/P&gt;&lt;P&gt;ERROR: The following columns were not found in the contributing tables: C&lt;/P&gt;&lt;P&gt;Could you help me with this error, please!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings!&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Milenko&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 14:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136553#M261165</guid>
      <dc:creator>MilenkoAndreas</dc:creator>
      <dc:date>2015-01-26T14:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136554#M261166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data WORK.FILA_FINAL_COUNT;&lt;/P&gt;&lt;P&gt;set WORK.query_for_query_final;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; insert into WORK.FILA_FINAL_COUNT&lt;/P&gt;&lt;P&gt;&amp;nbsp; select "Total" as data,sum(count) as count from WORK.query_for_query_final;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 15:04:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136554#M261166</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2015-01-26T15:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136555#M261167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One simple approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data y1;&lt;BR /&gt;input data $ count;&lt;BR /&gt;cards;&lt;BR /&gt;d1 100&lt;BR /&gt;d2 500&lt;BR /&gt;d3 800&lt;BR /&gt;d4 60&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table y2 as&lt;BR /&gt;select "total" as data, sum(count) as count&lt;BR /&gt;from y1;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data final;&lt;BR /&gt;set y1 y2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps !!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 15:21:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136555#M261167</guid>
      <dc:creator>yeshwanth</dc:creator>
      <dc:date>2015-01-26T15:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136556#M261168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Milenko,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is in response to the question you asked &lt;A __default_attr="5068" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;.&amp;nbsp; His code, with explanations, is shown below. The explanations are shown within comments, so that they don't have to be removed in order for the program to run:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; set have end=last; /*use have to create new file called want and creating an extra temporary variable&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; called 'end' that will only have a value of 1 when the last record from have is read */&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; _ct+count; /*create a variable called _c1 that, by the time the last record is read, will contain the sum of&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; all values of count*/&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; output; /* output the record */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; if last then &lt;SPAN style="line-height: 1.5em;"&gt;do; /*ONLY do the following after the last record has been output */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var='Total'; /*Change the value of var to be Total*/&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count=_CT; /* Change the value of Count to equal the value of _CT */&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output; /* Output the Total record */&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; drop _ct; /* Drop _ct from the list of variables that will be output */&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 15:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136556#M261168</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-01-26T15:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136557#M261169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Art! And my apologize to OP. I haven't realized being asked a follow-up question until Art mentioned my name. The bottom line is that there is no way for me to do a better job than Art anyway , so OP, consider yourself lucky.&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 15:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136557#M261169</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-01-26T15:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a Row at the end of the data with totals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136558#M261170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked perfectly! Thank you so much slchen!&lt;/P&gt;&lt;P&gt;Greetings!&lt;/P&gt;&lt;P&gt;Milenko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 18:07:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-a-Row-at-the-end-of-the-data-with-totals/m-p/136558#M261170</guid>
      <dc:creator>MilenkoAndreas</dc:creator>
      <dc:date>2015-01-26T18:07:09Z</dc:date>
    </item>
  </channel>
</rss>

