<?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: adding a total (for each column) to a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18635#M2825</link>
    <description>Hi.&lt;BR /&gt;
Base on this situation, I think proc tabulate and proc report would be best choice.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
    <pubDate>Tue, 01 Mar 2011 02:18:53 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-03-01T02:18:53Z</dc:date>
    <item>
      <title>adding a total (for each column) to a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18632#M2822</link>
      <description>I have three variables: location, a and b:&lt;BR /&gt;
location  a b&lt;BR /&gt;
x 1 2 &lt;BR /&gt;
y 1 2&lt;BR /&gt;
&lt;BR /&gt;
How do I add an observation to the variable location called total where a=2 (1+1) and b=4 (2+2) so that I have:&lt;BR /&gt;
location a b&lt;BR /&gt;
x 1 2&lt;BR /&gt;
y 1 2&lt;BR /&gt;
total 2 4&lt;BR /&gt;
&lt;BR /&gt;
Essentially what I want to do is to add an observation named total to the location variable that has the sum of columns a and b.&lt;BR /&gt;
&lt;BR /&gt;
Thank you.</description>
      <pubDate>Mon, 28 Feb 2011 17:34:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18632#M2822</guid>
      <dc:creator>gzr2mz39</dc:creator>
      <dc:date>2011-02-28T17:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: adding a total (for each column) to a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18633#M2823</link>
      <description>You could do something like:&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
set have end=eof;&lt;BR /&gt;
c+a;&lt;BR /&gt;
d+b;&lt;BR /&gt;
output;&lt;BR /&gt;
if eof then do;&lt;BR /&gt;
location="Total";&lt;BR /&gt;
a=c;&lt;BR /&gt;
b=d;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
drop c d;&lt;BR /&gt;
run;

Message was edited by: RickM</description>
      <pubDate>Mon, 28 Feb 2011 17:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18633#M2823</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2011-02-28T17:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: adding a total (for each column) to a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18634#M2824</link>
      <description>Thank you.</description>
      <pubDate>Mon, 28 Feb 2011 18:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18634#M2824</guid>
      <dc:creator>gzr2mz39</dc:creator>
      <dc:date>2011-02-28T18:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: adding a total (for each column) to a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18635#M2825</link>
      <description>Hi.&lt;BR /&gt;
Base on this situation, I think proc tabulate and proc report would be best choice.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Tue, 01 Mar 2011 02:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18635#M2825</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-03-01T02:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: adding a total (for each column) to a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18636#M2826</link>
      <description>how about a SUM statement on PROC PRINT ?</description>
      <pubDate>Wed, 02 Mar 2011 18:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18636#M2826</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-03-02T18:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: adding a total (for each column) to a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18637#M2827</link>
      <description>RickM posted what I was looking for.&lt;BR /&gt;
The goal was to incorporate the total (for each column) into the dataset.&lt;BR /&gt;
Thank you.</description>
      <pubDate>Wed, 02 Mar 2011 18:23:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18637#M2827</guid>
      <dc:creator>gzr2mz39</dc:creator>
      <dc:date>2011-03-02T18:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: adding a total (for each column) to a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18638#M2828</link>
      <description>Hi.&lt;BR /&gt;
Dear Peter.&lt;BR /&gt;
Op want ' Total :......' .&lt;BR /&gt;
I think proc print is difficult to print 'Total' ..&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 03 Mar 2011 03:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-a-total-for-each-column-to-a-dataset/m-p/18638#M2828</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-03-03T03:30:54Z</dc:date>
    </item>
  </channel>
</rss>

