<?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: Create grand total column with transposed data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-grand-total-column-with-transposed-data/m-p/442472#M110685</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input name  $     _12018   _22018  _32018;
datalines;
x                   1            2           3
y                   4            5           6
z                   7            8           9
;

data want;
set have;
total=sum(of _numeric_);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 05 Mar 2018 18:54:48 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-03-05T18:54:48Z</dc:date>
    <item>
      <title>Create grand total column with transposed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-grand-total-column-with-transposed-data/m-p/442469#M110684</link>
      <description>&lt;P&gt;I have data that I have transposed into numerous columns. The data is structured like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1-2018&amp;nbsp;&amp;nbsp; 2-2018&amp;nbsp; 3-2018&lt;/P&gt;&lt;P&gt;x&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; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;y&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; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;6&lt;/P&gt;&lt;P&gt;z&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; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add a total column to the end of this table, but do not know the best way to do so.&amp;nbsp; The column count changes from month to month as new columns are added.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure which PROC is the best way to tackle this.&lt;/P&gt;&lt;P&gt;Being new to SAS, I may not be searching for my topic the best way; if there are similar posts, I apologize.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 18:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-grand-total-column-with-transposed-data/m-p/442469#M110684</guid>
      <dc:creator>kbone1975</dc:creator>
      <dc:date>2018-03-05T18:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create grand total column with transposed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-grand-total-column-with-transposed-data/m-p/442472#M110685</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input name  $     _12018   _22018  _32018;
datalines;
x                   1            2           3
y                   4            5           6
z                   7            8           9
;

data want;
set have;
total=sum(of _numeric_);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 18:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-grand-total-column-with-transposed-data/m-p/442472#M110685</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-05T18:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create grand total column with transposed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-grand-total-column-with-transposed-data/m-p/442474#M110687</link>
      <description>&lt;P&gt;Make sure you have a naming convention, then you can use the short cut list to reference your variables. So if each of the columns that you need to add start with MONTH_, such as Month_201801, Month_201802, etc then you can do the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Total = sum(of month_: );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The other approach is to use a long format and then use PROC TABULATE to create the summaries as needed for reporting.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 18:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-grand-total-column-with-transposed-data/m-p/442474#M110687</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-05T18:57:39Z</dc:date>
    </item>
  </channel>
</rss>

