<?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 Sum two variables in Proc Report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sum-two-variables-in-Proc-Report/m-p/547644#M151779</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a sum of two variables with PROC REPORT. I'm new with this procedure and I'm not sure if it is possible to do what I'm looking for. Here is my code :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REPORT data=Res_perfo_overall nowd;
column Ref_Meth_POS nPositivePOS nNegativePOS;
define nPositivePOS / display;
define nNegativePOS / display;
define Ref_Meth_POS / computed "RM POS";
compute Ref_Meth_POS;
	Ref_Meth_POS = nPositivePOS + nNegativePOS;
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I'm getting this output :&amp;nbsp;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;RM POS nPositivePOS nNegativePOS &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;181&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;48&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I just want to know if it is possible to display the sum of the two colums with proc report instead of creating the variable in a data step (like 181+13, 0+0, 48+5, 0+0 and 7+2). If not I will create it directly in my data but I'm curious if it's possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2019 15:44:17 GMT</pubDate>
    <dc:creator>seboi49</dc:creator>
    <dc:date>2019-04-01T15:44:17Z</dc:date>
    <item>
      <title>Sum two variables in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-two-variables-in-Proc-Report/m-p/547644#M151779</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a sum of two variables with PROC REPORT. I'm new with this procedure and I'm not sure if it is possible to do what I'm looking for. Here is my code :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REPORT data=Res_perfo_overall nowd;
column Ref_Meth_POS nPositivePOS nNegativePOS;
define nPositivePOS / display;
define nNegativePOS / display;
define Ref_Meth_POS / computed "RM POS";
compute Ref_Meth_POS;
	Ref_Meth_POS = nPositivePOS + nNegativePOS;
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I'm getting this output :&amp;nbsp;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;RM POS nPositivePOS nNegativePOS &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;181&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;48&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I just want to know if it is possible to display the sum of the two colums with proc report instead of creating the variable in a data step (like 181+13, 0+0, 48+5, 0+0 and 7+2). If not I will create it directly in my data but I'm curious if it's possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 15:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-two-variables-in-Proc-Report/m-p/547644#M151779</guid>
      <dc:creator>seboi49</dc:creator>
      <dc:date>2019-04-01T15:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sum two variables in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-two-variables-in-Proc-Report/m-p/547651#M151783</link>
      <description>&lt;P&gt;You might try:&lt;/P&gt;
&lt;PRE&gt;PROC REPORT data=Res_perfo_overall nowd;
column  nPositivePOS nNegativePOS &lt;STRONG&gt;&lt;FONT color="#3366ff"&gt;Ref_Meth_POS&lt;/FONT&gt;&lt;/STRONG&gt;;
define nPositivePOS / display;
define nNegativePOS / display;
define Ref_Meth_POS / computed "RM POS";
compute Ref_Meth_POS;
	Ref_Meth_POS = _c1_ + _c2_;
endcomp;
run;&lt;/PRE&gt;
&lt;P&gt;Proc Report builds tables from left to right. So if you need a calculation then the result must be to the right of all the variables used.&lt;/P&gt;
&lt;P&gt;Second to use the values of cells you use the column number to reference, not the variable name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 16:23:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-two-variables-in-Proc-Report/m-p/547651#M151783</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-01T16:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sum two variables in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-two-variables-in-Proc-Report/m-p/547660#M151788</link>
      <description>All right thank you for your help!</description>
      <pubDate>Mon, 01 Apr 2019 17:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-two-variables-in-Proc-Report/m-p/547660#M151788</guid>
      <dc:creator>seboi49</dc:creator>
      <dc:date>2019-04-01T17:05:14Z</dc:date>
    </item>
  </channel>
</rss>

