<?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: Can't calculate horisontal difference in PROC REPORT in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Can-t-calculate-horisontal-difference-in-PROC-REPORT/m-p/978724#M84076</link>
    <description>&lt;P&gt;You need to refer to the variables with their .statistic extension. Also to prevent the label for Sex from being truncated at the Break line, you need to change the length.&lt;/P&gt;
&lt;P&gt;Revised code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
length sex $8;
set sashelp.class;
run;

proc report data= CLASS;
column Sex Height Weight Diff;
define Sex / group 'Sex'
style(column)={just= l }; 
define Height  / sum 'Height'
style(column)= {just= l }; 
define Weight / sum 'Weight'
style(column)= {just= l }; 
define  Diff / computed 'Diff'
style(column)= {just= r};  

compute Diff;
 Diff = Height.sum - Weight.sum;
endcomp;

compute before;
Sex='TOTALT';
endcomp;

rbreak before/ SUMMARIZE;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Nov 2025 13:05:41 GMT</pubDate>
    <dc:creator>Kathryn_SAS</dc:creator>
    <dc:date>2025-11-12T13:05:41Z</dc:date>
    <item>
      <title>Can't calculate horisontal difference in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Can-t-calculate-horisontal-difference-in-PROC-REPORT/m-p/978722#M84075</link>
      <description>&lt;P&gt;Can someone please help me and explain why I get the following messages when I run the code below?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: Variable Weight is uninitialized.&lt;BR /&gt;NOTE: Variable Height is uninitialized.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And why the column DIFF is empty in the result table?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;proc report&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; data= SASHELP.CLASS;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; column Sex Height Weight Diff;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; define Sex / group&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; 'Sex'&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; style(column)=&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; {just= l };&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; define Height&amp;nbsp; / sum&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; 'Height'&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; style(column)=&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; {just= l };&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; define Weight / sum&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; 'Weight'&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; style(column)=&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; {just= l };&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; define&amp;nbsp; Diff / computed 'Diff' &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; style(column)=&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; {just= r};&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; compute Diff;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Diff = Height - Weight;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; endcomp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; compute before;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sex='TOTALT';&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; endcomp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; rbreak before/ SUMMARIZE;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Nov 2025 12:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Can-t-calculate-horisontal-difference-in-PROC-REPORT/m-p/978722#M84075</guid>
      <dc:creator>Multipla99</dc:creator>
      <dc:date>2025-11-12T12:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Can't calculate horisontal difference in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Can-t-calculate-horisontal-difference-in-PROC-REPORT/m-p/978724#M84076</link>
      <description>&lt;P&gt;You need to refer to the variables with their .statistic extension. Also to prevent the label for Sex from being truncated at the Break line, you need to change the length.&lt;/P&gt;
&lt;P&gt;Revised code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
length sex $8;
set sashelp.class;
run;

proc report data= CLASS;
column Sex Height Weight Diff;
define Sex / group 'Sex'
style(column)={just= l }; 
define Height  / sum 'Height'
style(column)= {just= l }; 
define Weight / sum 'Weight'
style(column)= {just= l }; 
define  Diff / computed 'Diff'
style(column)= {just= r};  

compute Diff;
 Diff = Height.sum - Weight.sum;
endcomp;

compute before;
Sex='TOTALT';
endcomp;

rbreak before/ SUMMARIZE;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Nov 2025 13:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Can-t-calculate-horisontal-difference-in-PROC-REPORT/m-p/978724#M84076</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2025-11-12T13:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can't calculate horisontal difference in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Can-t-calculate-horisontal-difference-in-PROC-REPORT/m-p/978823#M84077</link>
      <description>&lt;P&gt;PROC REPORT can create the longer variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data= sashelp.CLASS;
column Sex Sex2 Height Weight Diff;
define Sex / group noprint;
define Sex2 /  group computed 'Sex' style(column)={just= l }; 
define Height  / sum 'Height' style(column)= {just= l }; 
define Weight / sum 'Weight' style(column)= {just= l }; 
define  Diff / computed 'Diff' style(column)= {just= r};  

compute sex2 / character length=8;
  sex2=sex;
endcomp;

compute Diff;
 Diff = Height.sum - Weight.sum;
endcomp;

compute before;
Sex2='TOTAL';
endcomp;

rbreak before/ SUMMARIZE;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1763049024597.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111289iB399AD2E37902E19/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1763049024597.png" alt="Tom_0-1763049024597.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2025 15:50:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Can-t-calculate-horisontal-difference-in-PROC-REPORT/m-p/978823#M84077</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-11-13T15:50:32Z</dc:date>
    </item>
  </channel>
</rss>

