<?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: Proc Report compute difference between values of across variable in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611829#M23616</link>
    <description>&lt;P&gt;I think you need to refer to these columns as _C1_ and _C2_&lt;/P&gt;</description>
    <pubDate>Sun, 15 Dec 2019 00:55:10 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-12-15T00:55:10Z</dc:date>
    <item>
      <title>Proc Report compute difference between values of across variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611828#M23615</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using Proc Report I am trying to calculate the difference between the values of two cells under an across variable. Even after reading through some of the discussions and whitepapers I still can't get this to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using below sample data the desired result in the first row under column diff_X1X2 is 1&amp;nbsp; ( 3-2) and -0.666.. in the 2nd row.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do know that the value in categorical variable &lt;EM&gt;catX&lt;/EM&gt; is either 'X1' or 'X2'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover dlm=',' dsd;
  input catX $ catY $ value;
  datalines;
X1,Y1,2
X1,Y1,4
X1,Y2,1
X1,Y2,3
X2,Y1,2
X2,Y2,2
X2,Y2,3
X2,Y2,3
;

proc report data=have nowd;
  column  catY (catX, value diff_X1X2;  
  define catY  / group ;
  define catX  / group across;
  define value / analysis mean;
  define diff_X1X2  / computed;
  compute diff_X1X2;
    diff_X1X2=_c_1-_c_2;
  endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 214px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34775iE88C4D96BB2D0EFA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2019 00:52:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611828#M23615</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-12-15T00:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report compute difference between values of across variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611829#M23616</link>
      <description>&lt;P&gt;I think you need to refer to these columns as _C1_ and _C2_&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2019 00:55:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611829#M23616</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-15T00:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report compute difference between values of across variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611830#M23617</link>
      <description>&lt;P&gt;I suspect CatY may also count as a column so it could be _C2_ and _C3_.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2019 01:03:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611830#M23617</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-12-15T01:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report compute difference between values of across variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611831#M23618</link>
      <description>&lt;P&gt;Yep that's it &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2019 01:08:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611831#M23618</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-15T01:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report compute difference between values of across variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611859#M23619</link>
      <description>&lt;P&gt;As SASKiWI said ,it _c2_ and _c3_ , you could check its real name by option&lt;STRONG&gt; OUT=&lt;/STRONG&gt; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover dlm=',' dsd;
  input catX $ catY $ value;
  datalines;
X1,Y1,2
X1,Y1,4
X1,Y2,1
X1,Y2,3
X2,Y1,2
X2,Y2,2
X2,Y2,3
X2,Y2,3
;

proc report data=have nowd out=temp;
  column  catY (catX, value diff_X1X2);  
  define catY  / group ;
  define catX  / group across;
  define value / analysis mean;
  define diff_X1X2  / computed;
  compute diff_X1X2;
    diff_X1X2=_c2_-_c3_;
  endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 Dec 2019 10:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611859#M23619</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-12-15T10:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report compute difference between values of across variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611860#M23620</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=have nowd;
	column  catY (catX, value diff_X1X2);  
	
	define catY  / group ;
	define catX  / across;
	define value / analysis mean;
	define diff_X1X2  / computed;
 
	compute diff_X1X2;
		diff_X1X2=_c2_-_c3_;
	endcomp;
  
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 Dec 2019 10:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-compute-difference-between-values-of-across-variable/m-p/611860#M23620</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-15T10:12:22Z</dc:date>
    </item>
  </channel>
</rss>

