<?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: replace proc tabulate w proc report help in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/replace-proc-tabulate-w-proc-report-help/m-p/33305#M4862</link>
    <description>Hi:&lt;BR /&gt;
  A BREAK statement should take care of a summary line at the bottom of the report. You also do not need a computed variable for the last column. Consider the following example. This is the final report in the LISTING window:&lt;BR /&gt;
[pre]&lt;BR /&gt;
                             Region Actual Sales&lt;BR /&gt;
  Country     Product             EAST          WEST   Grand Total&lt;BR /&gt;
  CANADA      BED           $27,196.00    $20,533.00    $47,729.00&lt;BR /&gt;
              CHAIR         $25,200.00    $25,039.00    $50,239.00&lt;BR /&gt;
              DESK          $25,020.00    $27,167.00    $52,187.00&lt;BR /&gt;
              SOFA          $24,124.00    $26,011.00    $50,135.00&lt;BR /&gt;
              TABLE         $25,945.00    $20,755.00    $46,700.00&lt;BR /&gt;
  CANADA                   $127,485.00   $119,505.00   $246,990.00&lt;BR /&gt;
                          &lt;BR /&gt;
  GERMANY     BED           $23,537.00    $22,597.00    $46,134.00&lt;BR /&gt;
              CHAIR         $23,277.00    $23,828.00    $47,105.00&lt;BR /&gt;
              DESK          $25,403.00    $23,099.00    $48,502.00&lt;BR /&gt;
              SOFA          $26,214.00    $28,846.00    $55,060.00&lt;BR /&gt;
              TABLE         $26,116.00    $23,081.00    $49,197.00&lt;BR /&gt;
  GERMANY                  $124,547.00   $121,451.00   $245,998.00&lt;BR /&gt;
                                  &lt;BR /&gt;
  U.S.A.      BED           $23,137.00    $25,037.00    $48,174.00&lt;BR /&gt;
              CHAIR         $27,378.00    $23,558.00    $50,936.00&lt;BR /&gt;
              DESK          $23,193.00    $25,350.00    $48,543.00&lt;BR /&gt;
              SOFA          $22,263.00    $21,130.00    $43,393.00&lt;BR /&gt;
              TABLE         $22,258.00    $24,045.00    $46,303.00&lt;BR /&gt;
  U.S.A.                   $118,229.00   $119,120.00   $237,349.00&lt;BR /&gt;
                                      &lt;BR /&gt;
  Total                    $370,261.00   $360,076.00   $730,337.00&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                 &lt;BR /&gt;
The summary line marked "Total" was from an RBREAK statement. The summary line after each COUNTRY value was from a BREAK statement. The skipped line under each COUNTRY group was from a COMPUTE block with a LINE statement. The column marked "Grand Total" came from using ACTUAL with an alias (TOTACT) so that ACTUAL could be used one time with the ACROSS value and another time (with the alias value) for a Grand Total. The PROC REPORT code is below. PROC REPORT does not have the universal class variable ALL as TABULATE does, but you can do simple ACROSS reports with PROC REPORT -almost- as easy as you can with TABULATE.&lt;BR /&gt;
   &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods listing;&lt;BR /&gt;
options nodate nonumber nocenter;&lt;BR /&gt;
ods html file='c:\temp\sumreg.html' style=sasweb;&lt;BR /&gt;
&lt;BR /&gt;
  proc report data=sashelp.prdsale nowd;&lt;BR /&gt;
    title 'Row Totals with Break Statements';&lt;BR /&gt;
    title2 'Column Total Using Alias Method';&lt;BR /&gt;
    column country product actual,region actual=totact;&lt;BR /&gt;
    define country / group;&lt;BR /&gt;
    define product / group;&lt;BR /&gt;
    define region / across 'Region Actual Sales';&lt;BR /&gt;
    define actual / sum ' ';&lt;BR /&gt;
    define totact / sum 'Grand Total';&lt;BR /&gt;
    break after country / summarize;&lt;BR /&gt;
    rbreak after / summarize;&lt;BR /&gt;
    compute after country;&lt;BR /&gt;
      line ' ';&lt;BR /&gt;
    endcomp;&lt;BR /&gt;
    compute after;&lt;BR /&gt;
      country = 'Total';&lt;BR /&gt;
    endcomp;&lt;BR /&gt;
  run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Fri, 18 Mar 2011 21:39:27 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2011-03-18T21:39:27Z</dc:date>
    <item>
      <title>replace proc tabulate w proc report help</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/replace-proc-tabulate-w-proc-report-help/m-p/33304#M4861</link>
      <description>I decided to expand my skill set and try proc report instead tabulate.  I need another column in the table and I thought it might be easier to just "report" than to prepare the data for tabulate output.&lt;BR /&gt;
&lt;BR /&gt;
Just below is the tabulate and how far I've come with report.  I'm stuck with the compute section.  Help to get me going again would be appreciated.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc tabulate data=warmpln format=comma7.0;                                                                                                             &lt;BR /&gt;
  format WarmType $WType.;                                                                                                                              &lt;BR /&gt;
  class OpCd WarmType;                                                                                                                                  &lt;BR /&gt;
  var Wt freq PceWt;                                                                                                                                    &lt;BR /&gt;
  table All OpCd=' ',                                                                                                                                   &lt;BR /&gt;
       (All WarmType='Warmer Type') *                                                                                                                   &lt;BR /&gt;
       (Wt='Weight in Tons' freq='Piece Count' PceWt)*sum=' ';                                                                                          &lt;BR /&gt;
run;                                                                                                                                                    &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
PROC REPORT DATA=WORK.WARMPLN  SPLIT="/" CENTER nowd;                                                                                                   &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
COLUMN  OpCd WarmType,(wt _FREQ_) allrow allcol pcewt;                                                                                                  &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
DEFINE  OpCd     / GROUP           FORMAT= $4.        WIDTH=10    SPACING=2   LEFT "Operation Code " ;                                                  &lt;BR /&gt;
DEFINE  WarmType / ACROSS          FORMAT= $WType.    WIDTH=10    SPACING=2   LEFT "Warmer Type" ;                                                      &lt;BR /&gt;
DEFINE  wt       / analysis SUM    FORMAT= comma7.    WIDTH=9     SPACING=2   RIGHT "Weight in Tons" ;                                                  &lt;BR /&gt;
DEFINE  _FREQ_   / analysis SUM    FORMAT= BEST9.     WIDTH=9     SPACING=2   RIGHT "Piece Count" ;                                                     &lt;BR /&gt;
DEFINE  AllRow   / computed        Format= best9.     width=9     spacing=2   Right "AllRow";                                                           &lt;BR /&gt;
DEFINE  AllCol   / computed        Format= best9.     width=9     spacing=2   Right "AllCol";                                                           &lt;BR /&gt;
define  PceWt    / computed        Format= comma7.    width=9     spacing=2   Right "PceWt";      ;                                                     &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
**need column totals (across WarmType) and row totals (summing OpCd levels);                                                                            &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
compute AllRow;                                                                                                                                         &lt;BR /&gt;
  AllRow=wt.sum;                                                                                                                                        &lt;BR /&gt;
endcomp;                                                                                                                                                &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
*add a new column of wt/_freq_;                                                                                                                         &lt;BR /&gt;
compute PceWt;                                                                                                                                          &lt;BR /&gt;
  PceWt=wt/_freq_;                                                                                                                                      &lt;BR /&gt;
endcomp;                                                                                                                                                &lt;BR /&gt;
                                                                                                                                                        &lt;BR /&gt;
RUN;</description>
      <pubDate>Fri, 18 Mar 2011 16:56:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/replace-proc-tabulate-w-proc-report-help/m-p/33304#M4861</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2011-03-18T16:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: replace proc tabulate w proc report help</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/replace-proc-tabulate-w-proc-report-help/m-p/33305#M4862</link>
      <description>Hi:&lt;BR /&gt;
  A BREAK statement should take care of a summary line at the bottom of the report. You also do not need a computed variable for the last column. Consider the following example. This is the final report in the LISTING window:&lt;BR /&gt;
[pre]&lt;BR /&gt;
                             Region Actual Sales&lt;BR /&gt;
  Country     Product             EAST          WEST   Grand Total&lt;BR /&gt;
  CANADA      BED           $27,196.00    $20,533.00    $47,729.00&lt;BR /&gt;
              CHAIR         $25,200.00    $25,039.00    $50,239.00&lt;BR /&gt;
              DESK          $25,020.00    $27,167.00    $52,187.00&lt;BR /&gt;
              SOFA          $24,124.00    $26,011.00    $50,135.00&lt;BR /&gt;
              TABLE         $25,945.00    $20,755.00    $46,700.00&lt;BR /&gt;
  CANADA                   $127,485.00   $119,505.00   $246,990.00&lt;BR /&gt;
                          &lt;BR /&gt;
  GERMANY     BED           $23,537.00    $22,597.00    $46,134.00&lt;BR /&gt;
              CHAIR         $23,277.00    $23,828.00    $47,105.00&lt;BR /&gt;
              DESK          $25,403.00    $23,099.00    $48,502.00&lt;BR /&gt;
              SOFA          $26,214.00    $28,846.00    $55,060.00&lt;BR /&gt;
              TABLE         $26,116.00    $23,081.00    $49,197.00&lt;BR /&gt;
  GERMANY                  $124,547.00   $121,451.00   $245,998.00&lt;BR /&gt;
                                  &lt;BR /&gt;
  U.S.A.      BED           $23,137.00    $25,037.00    $48,174.00&lt;BR /&gt;
              CHAIR         $27,378.00    $23,558.00    $50,936.00&lt;BR /&gt;
              DESK          $23,193.00    $25,350.00    $48,543.00&lt;BR /&gt;
              SOFA          $22,263.00    $21,130.00    $43,393.00&lt;BR /&gt;
              TABLE         $22,258.00    $24,045.00    $46,303.00&lt;BR /&gt;
  U.S.A.                   $118,229.00   $119,120.00   $237,349.00&lt;BR /&gt;
                                      &lt;BR /&gt;
  Total                    $370,261.00   $360,076.00   $730,337.00&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                 &lt;BR /&gt;
The summary line marked "Total" was from an RBREAK statement. The summary line after each COUNTRY value was from a BREAK statement. The skipped line under each COUNTRY group was from a COMPUTE block with a LINE statement. The column marked "Grand Total" came from using ACTUAL with an alias (TOTACT) so that ACTUAL could be used one time with the ACROSS value and another time (with the alias value) for a Grand Total. The PROC REPORT code is below. PROC REPORT does not have the universal class variable ALL as TABULATE does, but you can do simple ACROSS reports with PROC REPORT -almost- as easy as you can with TABULATE.&lt;BR /&gt;
   &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods listing;&lt;BR /&gt;
options nodate nonumber nocenter;&lt;BR /&gt;
ods html file='c:\temp\sumreg.html' style=sasweb;&lt;BR /&gt;
&lt;BR /&gt;
  proc report data=sashelp.prdsale nowd;&lt;BR /&gt;
    title 'Row Totals with Break Statements';&lt;BR /&gt;
    title2 'Column Total Using Alias Method';&lt;BR /&gt;
    column country product actual,region actual=totact;&lt;BR /&gt;
    define country / group;&lt;BR /&gt;
    define product / group;&lt;BR /&gt;
    define region / across 'Region Actual Sales';&lt;BR /&gt;
    define actual / sum ' ';&lt;BR /&gt;
    define totact / sum 'Grand Total';&lt;BR /&gt;
    break after country / summarize;&lt;BR /&gt;
    rbreak after / summarize;&lt;BR /&gt;
    compute after country;&lt;BR /&gt;
      line ' ';&lt;BR /&gt;
    endcomp;&lt;BR /&gt;
    compute after;&lt;BR /&gt;
      country = 'Total';&lt;BR /&gt;
    endcomp;&lt;BR /&gt;
  run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 18 Mar 2011 21:39:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/replace-proc-tabulate-w-proc-report-help/m-p/33305#M4862</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-03-18T21:39:27Z</dc:date>
    </item>
  </channel>
</rss>

