<?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: How do I sum rows i all columns at once in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-sum-rows-i-all-columns-at-once/m-p/818283#M323000</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have nway;
    class id;
    var _numeric_;
    output out=want sum=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This assumes ID is character. If you don't want ALL numeric variables to be summed, you can write queries with SQL to extract variable names of interest, put those variable names in a macro variable and then use that instead of _NUMERIC_.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jun 2022 12:26:14 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-06-15T12:26:14Z</dc:date>
    <item>
      <title>How do I sum rows i all columns at once</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-sum-rows-i-all-columns-at-once/m-p/818282#M322999</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have this problem regarding aggregating a table. For example, my table should look like this&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;books&lt;/TD&gt;&lt;TD&gt;toys&lt;/TD&gt;&lt;TD&gt;PCs&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;564&lt;/TD&gt;&lt;TD&gt;354&lt;/TD&gt;&lt;TD&gt;184&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;454&lt;/TD&gt;&lt;TD&gt;794&lt;/TD&gt;&lt;TD&gt;174&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;564&lt;/TD&gt;&lt;TD&gt;373&lt;/TD&gt;&lt;TD&gt;194&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;54&lt;/TD&gt;&lt;TD&gt;397&lt;/TD&gt;&lt;TD&gt;134&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;644&lt;/TD&gt;&lt;TD&gt;361&lt;/TD&gt;&lt;TD&gt;764&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;except it is a lot bigger. Now, I need to do vertical sum and grouping by ID. The final table should look like this&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;books&lt;/TD&gt;&lt;TD&gt;toys&lt;/TD&gt;&lt;TD&gt;PCs&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1018&lt;/TD&gt;&lt;TD&gt;1148&lt;/TD&gt;&lt;TD&gt;358&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;618&lt;/TD&gt;&lt;TD&gt;770&lt;/TD&gt;&lt;TD&gt;328&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;644&lt;/TD&gt;&lt;TD&gt;361&lt;/TD&gt;&lt;TD&gt;764&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;This alone would be easy, but now comes the twist. I have many columns and they change quite often, so I would love some solution which uses a vector of column names or an option to sum all the columns irrespective of the column names. Is there such an option?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bajtan&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 12:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-sum-rows-i-all-columns-at-once/m-p/818282#M322999</guid>
      <dc:creator>bajtan</dc:creator>
      <dc:date>2022-06-15T12:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sum rows i all columns at once</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-sum-rows-i-all-columns-at-once/m-p/818283#M323000</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have nway;
    class id;
    var _numeric_;
    output out=want sum=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This assumes ID is character. If you don't want ALL numeric variables to be summed, you can write queries with SQL to extract variable names of interest, put those variable names in a macro variable and then use that instead of _NUMERIC_.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 12:26:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-sum-rows-i-all-columns-at-once/m-p/818283#M323000</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-15T12:26:14Z</dc:date>
    </item>
  </channel>
</rss>

