<?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 Tabulate - append hardcoded columns to a descriptive statistics table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-append-hardcoded-columns-to-a-descriptive/m-p/727856#M226443</link>
    <description>Proc Tabulate only takes a single data set as a source so you have to make it into one table first somehow. &lt;BR /&gt;You could add that data to your current input table as a separate "firm"  but with the idea that the mean of 1 value is itself so that may work. &lt;BR /&gt;&lt;BR /&gt;Another way is to pipe your proc tabulate output to a data set using the OUT=option, merge that with the pre-calculated data and then use PROC REPORT to display it as desired.&lt;BR /&gt;</description>
    <pubDate>Fri, 19 Mar 2021 19:36:27 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-03-19T19:36:27Z</dc:date>
    <item>
      <title>Proc Tabulate - append hardcoded columns to a descriptive statistics table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-append-hardcoded-columns-to-a-descriptive/m-p/727855#M226442</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I'm using SAS 9. I am replicating a paper, and I am trying to show that my results are comparable to the results in the paper with a side-by-side table. See picture below for an example. In the example, my results would be the "Our Replication" section and the results I'm referencing would go into the "Cooper and Boynton (2004)" section.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is - is it possible to append columns with hard-coded numbers to a table using proc tabulate? Is there a better way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (34).png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56183i963DB685B96CE184/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot (34).png" alt="Screenshot (34).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code for the portion of the table displaying my results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC FORMAT;
  VALUE  lossfirm 0="Non-Loss Firm"
                1="Loss Firm" ;
RUN;

proc tabulate data=x1;
title 'Replication';
class lossfirm;
var at ti ni;
table at='Total Assets ($millions)'*(N*F=COMMA.0 MEAN*F=COMMA.0) ti='Taxable Income ($millions)'*(MEAN*F=COMMA.0) ni='Net Income ($millions)'*(MEAN*F=COMMA.0) ,
(lossfirm='' ALL='All Firms') ;
FORMAT lossfirm lossfirm.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 19:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-append-hardcoded-columns-to-a-descriptive/m-p/727855#M226442</guid>
      <dc:creator>fostet85</dc:creator>
      <dc:date>2021-03-19T19:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - append hardcoded columns to a descriptive statistics table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-append-hardcoded-columns-to-a-descriptive/m-p/727856#M226443</link>
      <description>Proc Tabulate only takes a single data set as a source so you have to make it into one table first somehow. &lt;BR /&gt;You could add that data to your current input table as a separate "firm"  but with the idea that the mean of 1 value is itself so that may work. &lt;BR /&gt;&lt;BR /&gt;Another way is to pipe your proc tabulate output to a data set using the OUT=option, merge that with the pre-calculated data and then use PROC REPORT to display it as desired.&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2021 19:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-append-hardcoded-columns-to-a-descriptive/m-p/727856#M226443</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-19T19:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - append hardcoded columns to a descriptive statistics table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-append-hardcoded-columns-to-a-descriptive/m-p/727860#M226444</link>
      <description>&lt;P&gt;You can construct synthetic data that would produce the Cooper/Boynton statistics.&amp;nbsp; &amp;nbsp;Adding a new variable STUDY (= 'Cooper and Boynton (2004)' or 'Our Replication') and using STUDY as a new class variable, should do the trick:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data combined (drop=i _:);
  set x1 end=end_of_x1;
  retain study "Our Replication        ";
  output;
  if end_of_x1;
  infile datalines;
  study='Cooper and boynton (2004)';
  input lossfirm _n at ti ni    _nall _atall _tiall _niall ;
  do i=1 to _n; 
    output;      ** Output loss firms **;
  end; 
  /* ******** Gen at,ti,ni (x) for non-loss firms   ****** */
  /* We know that  _nall*_atall =   _n*at + (_nall-_n)*x   */
  /*  ==&amp;gt;   (_nall-_n)*x   = _nall*_atall - _n*at          */
  /*  ==&amp;gt;   x = (_nall*_atall - _n*at)/(_nall-_n)          */
  at = (_nall*_atall - _b*at)/(_nall-_n);
  ti = (_nall*_tiall - _b*ti)/(_nall-_n);
  ni = (_nall*_niall - _b*ni)/(_nall-_n);
  do i=1 to (_nall-_n);
    output;
  end;
datalines;
1  9088  4303409 -159907 -159107  27384 26100649 442705 322621 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What I don't understand is how you got tabulate to drop the non-loss firm columns.&amp;nbsp; But ignoring that, notice how the program imputes the values for the non-loss firms that would replicate the values for ALL firms.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be able to apply proc tabulate to the COMBINED data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 20:38:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-append-hardcoded-columns-to-a-descriptive/m-p/727860#M226444</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-19T20:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - append hardcoded columns to a descriptive statistics table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-append-hardcoded-columns-to-a-descriptive/m-p/727861#M226445</link>
      <description>&lt;P&gt;You may be better off summarizing the data. Then use Proc Report for display.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 20:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-append-hardcoded-columns-to-a-descriptive/m-p/727861#M226445</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-19T20:53:00Z</dc:date>
    </item>
  </channel>
</rss>

