<?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 to add add up several categories in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774744#M31245</link>
    <description>&lt;P&gt;You have to do this in a DATA step, using the SUM function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    total=sum(of candy--sandwiches);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    total=sum(candy,chips,fruit,sandwiches);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also, since you are new, it might help you in the future to use the proper terminology ... candy and chips and fruit and sandwiches are VARIABLES and not categories.&lt;/P&gt;</description>
    <pubDate>Sun, 17 Oct 2021 19:02:03 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-10-17T19:02:03Z</dc:date>
    <item>
      <title>How to add add up several categories</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774743#M31244</link>
      <description>&lt;P&gt;I'm new to sas. I'm trying to do most of it myself but I'm having a little trouble. I want to total up four categories but for each individual value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was my code for totaling columns. I don't know how to total rows and I have like 5000 rows. Is it something similar to this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc print data=lab.data;&lt;BR /&gt;sum candy;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&g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amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;86.6&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;TD&gt;70&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 17 Oct 2021 18:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774743#M31244</guid>
      <dc:creator>Bananas</dc:creator>
      <dc:date>2021-10-17T18:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to add add up several categories</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774744#M31245</link>
      <description>&lt;P&gt;You have to do this in a DATA step, using the SUM function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    total=sum(of candy--sandwiches);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    total=sum(candy,chips,fruit,sandwiches);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also, since you are new, it might help you in the future to use the proper terminology ... candy and chips and fruit and sandwiches are VARIABLES and not categories.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 19:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774744#M31245</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-17T19:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to add add up several categories</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774745#M31246</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;would I still use the code below to see the new table. When i do this, it gives me the totals of the columns, not the rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc print data= work.transform;&lt;BR /&gt;sum candy chips fruit sandwiches;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 19:21:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774745#M31246</guid>
      <dc:creator>Bananas</dc:creator>
      <dc:date>2021-10-17T19:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to add add up several categories</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774747#M31247</link>
      <description>&lt;P&gt;Please post the code that creates WORK.TRANSFORM.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 19:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774747#M31247</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-17T19:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to add add up several categories</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774749#M31248</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I appreciate anyone who is taking the time to help me. I'm trying to learn online.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's just the name of my data table. I had to multiply each variable by a certain number so it was:&lt;/P&gt;&lt;P&gt;DATA transform;&lt;BR /&gt;set lab.food;&lt;BR /&gt;chips= chips2 *4;&lt;BR /&gt;sandwiches= sandwiches2 *4;&lt;BR /&gt;fruit= fruit2 *9;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then i used the below code to show the new table.&lt;/P&gt;&lt;P&gt;proc print data=work.transform;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;That's where I got work.transform from.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 20:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774749#M31248</guid>
      <dc:creator>Bananas</dc:creator>
      <dc:date>2021-10-17T20:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to add add up several categories</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774763#M31252</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/403194"&gt;@Bananas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;would I still use the code below to see the new table. When i do this, it gives me the totals of the columns, not the rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data= work.transform;&lt;BR /&gt;sum candy chips fruit sandwiches;&lt;BR /&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I gave you code that works to sum across the rows. PROC PRINT, as you can see, only sums columns.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 21:32:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774763#M31252</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-17T21:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to add add up several categories</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774764#M31253</link>
      <description>&lt;P&gt;Hi Paige,&lt;/P&gt;&lt;P&gt;thank you. Sorry to be a bother, I'm just having a hard time actually seeing the totals of the rows individually. The code you gave me did work as the log said. I will figure out how to see it in the output. Thanks for your help again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 21:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774764#M31253</guid>
      <dc:creator>Bananas</dc:creator>
      <dc:date>2021-10-17T21:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to add add up several categories</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774766#M31254</link>
      <description>&lt;P&gt;PROC PRINT or any dataviewer in SAS will show you the values in the new data set which I named WANT.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 21:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-add-add-up-several-categories/m-p/774766#M31254</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-17T21:46:53Z</dc:date>
    </item>
  </channel>
</rss>

