<?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 How to sum certain columns in all rows and make a new column with the sum value. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-certain-columns-in-all-rows-and-make-a-new-column/m-p/432914#M281814</link>
    <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to add the appearance, pulse, grimace, activity, and respiration columns for each baby ID and make a new sum column like below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output.jpg" style="width: 566px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18242i8C63DD9A2CD93B48/image-dimensions/566x318?v=v2" width="566" height="318" role="button" title="output.jpg" alt="output.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So the first number in the sum column would be 7, the second number would be 6 and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I made up:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Question2a;
title 'Minute1 dataset plus score';
set Homework.minute1;
sum = 'Appearance'+'Pulse'+'Grimace'+'Activity'+'Respiration';
keep Baby_ID Appearance Pulse Grimace Activity Respiration sum;
run;
proc print data=question2a;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2018 21:17:25 GMT</pubDate>
    <dc:creator>newbie_grad</dc:creator>
    <dc:date>2018-01-31T21:17:25Z</dc:date>
    <item>
      <title>How to sum certain columns in all rows and make a new column with the sum value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-certain-columns-in-all-rows-and-make-a-new-column/m-p/432914#M281814</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to add the appearance, pulse, grimace, activity, and respiration columns for each baby ID and make a new sum column like below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output.jpg" style="width: 566px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18242i8C63DD9A2CD93B48/image-dimensions/566x318?v=v2" width="566" height="318" role="button" title="output.jpg" alt="output.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So the first number in the sum column would be 7, the second number would be 6 and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I made up:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Question2a;
title 'Minute1 dataset plus score';
set Homework.minute1;
sum = 'Appearance'+'Pulse'+'Grimace'+'Activity'+'Respiration';
keep Baby_ID Appearance Pulse Grimace Activity Respiration sum;
run;
proc print data=question2a;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 21:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sum-certain-columns-in-all-rows-and-make-a-new-column/m-p/432914#M281814</guid>
      <dc:creator>newbie_grad</dc:creator>
      <dc:date>2018-01-31T21:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum certain columns in all rows and make a new column with the sum value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-certain-columns-in-all-rows-and-make-a-new-column/m-p/432918#M281815</link>
      <description>&lt;P&gt;assuming baby_id is char var. You could do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;sum=sum(of _numeric_);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 21:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sum-certain-columns-in-all-rows-and-make-a-new-column/m-p/432918#M281815</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-31T21:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum certain columns in all rows and make a new column with the sum value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-certain-columns-in-all-rows-and-make-a-new-column/m-p/432920#M281816</link>
      <description>&lt;P&gt;You cannot perform arithmetic on string literals. Use the variable names. If you have the VALIDVARNAME option set to any then you could use name literals to allow you to program with a name that include embedded spaces and other non-standard things.&lt;/P&gt;
&lt;P&gt;You might want to also check how the SUM() function differs from simple + operator.&amp;nbsp; (Hint what do you want for SUM when there is no value for PULSE?)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Question2a;
  set Homework.minute1;
  sum = sum( of Appearance Pulse Grimace Activity Respiration);
run;

title 'Minute1 dataset plus score';
proc print data=question2a;
  var Baby_ID Appearance Pulse Grimace Activity Respiration sum;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jan 2018 21:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sum-certain-columns-in-all-rows-and-make-a-new-column/m-p/432920#M281816</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-31T21:24:53Z</dc:date>
    </item>
  </channel>
</rss>

