<?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 Add a new field to proc report with total of some fields in a row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Add-a-new-field-to-proc-report-with-total-of-some-fields-in-a/m-p/477036#M122801</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have &amp;nbsp;simple proc report example.&lt;/P&gt;&lt;P&gt;I have 4 numeric fields and I want to create one more column with sum of x1,x2,x3,x4.&lt;/P&gt;&lt;P&gt;Please pay attention that it might happen that in x1,x2,x3,x4 there is a null value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; Data tbl;
 input branch X1  X2  X3  X4;
 cards;
 1  10 20 30 40 
 2  15 20 25 30
 3  35 40 45 50
 4  55 60 65 .
 ;
 run;


proc report data=tbl  headline split='#' spacing=1 nowd
style(report)={cellpadding=1 cellspacing=1}
style(header)={font_size=2  font_weight=MEDIUM  font_face=david  background=cx99ccaa}
style(column)={font_size=1}; 
columns  branch X1  X2  X3  X4 ;
define branch/ display 
	"Branch"  center;
define X1/  Display "X1 amount";
define X2/  Display "X2 amount";
define X3/  Display "X3 amount";
define X4/  Display "X4 amount";
Run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 11 Jul 2018 11:08:29 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2018-07-11T11:08:29Z</dc:date>
    <item>
      <title>Add a new field to proc report with total of some fields in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-a-new-field-to-proc-report-with-total-of-some-fields-in-a/m-p/477036#M122801</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have &amp;nbsp;simple proc report example.&lt;/P&gt;&lt;P&gt;I have 4 numeric fields and I want to create one more column with sum of x1,x2,x3,x4.&lt;/P&gt;&lt;P&gt;Please pay attention that it might happen that in x1,x2,x3,x4 there is a null value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; Data tbl;
 input branch X1  X2  X3  X4;
 cards;
 1  10 20 30 40 
 2  15 20 25 30
 3  35 40 45 50
 4  55 60 65 .
 ;
 run;


proc report data=tbl  headline split='#' spacing=1 nowd
style(report)={cellpadding=1 cellspacing=1}
style(header)={font_size=2  font_weight=MEDIUM  font_face=david  background=cx99ccaa}
style(column)={font_size=1}; 
columns  branch X1  X2  X3  X4 ;
define branch/ display 
	"Branch"  center;
define X1/  Display "X1 amount";
define X2/  Display "X2 amount";
define X3/  Display "X3 amount";
define X4/  Display "X4 amount";
Run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Jul 2018 11:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-a-new-field-to-proc-report-with-total-of-some-fields-in-a/m-p/477036#M122801</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-07-11T11:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Add a new field to proc report with total of some fields in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-a-new-field-to-proc-report-with-total-of-some-fields-in-a/m-p/477042#M122803</link>
      <description>&lt;P&gt;I found the answer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc report data=tbl headline split='#' spacing=1 nowd&lt;BR /&gt;style(report)={cellpadding=1 cellspacing=1}&lt;BR /&gt;style(header)={font_size=2 font_weight=MEDIUM font_face=david background=cx99ccaa}&lt;BR /&gt;style(column)={font_size=1};&lt;BR /&gt;columns branch X1 X2 X3 X4 total;&lt;BR /&gt;define branch/ display&lt;BR /&gt;"Branch" center;&lt;BR /&gt;define X1/ Display "X1 amount";&lt;BR /&gt;define X2/ Display "X2 amount";&lt;BR /&gt;define X3/ Display "X3 amount";&lt;BR /&gt;define X4/ Display "X4 amount";&lt;BR /&gt;define total/computed;&lt;BR /&gt;compute total;&lt;BR /&gt;total=sum(x1,x2,x3,x4);./*Will not get null if there is null value in x1,x2,x3,x4*/&lt;BR /&gt;endcomp;&lt;BR /&gt;Run;&lt;BR /&gt;/*total=x1+x2+x3+x4; */&lt;BR /&gt;/*Will get null if there is null value in x1,x2,x3,x4*/&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 11:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-a-new-field-to-proc-report-with-total-of-some-fields-in-a/m-p/477042#M122803</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-07-11T11:46:07Z</dc:date>
    </item>
  </channel>
</rss>

