<?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 Blocks in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20666#M3813</link>
    <description>That looks like what I'm trying to accomplish.  However, the number of columns can vary in any given month/quarter, as our funds and activities change (there is a different column for each donor scholarship, for example).&lt;BR /&gt;
&lt;BR /&gt;
I've been experimenting with trying to incorporate a macro within a compute statement that would count the number of columns (which would be the number of unique FUNDGROUP codes) and then perform a calculation for each.  This seems to be more complicated than I am familiar with, however...  Any ideas on how we might make it dynamic?  If not, I can hard-code.&lt;BR /&gt;
&lt;BR /&gt;
Thanks so much for pointing me in the right direction!</description>
    <pubDate>Fri, 22 Oct 2010 13:10:03 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-10-22T13:10:03Z</dc:date>
    <item>
      <title>PROC Report Compute Blocks</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20662#M3809</link>
      <description>Good day SAS programmers, &lt;BR /&gt;
&lt;BR /&gt;
I have what must be a simple formatting issue.  I am attempting to &lt;BR /&gt;
prepare a flash financial statement using SAS from our Oracle &lt;BR /&gt;
database.  I have the data fine, but in PROC REPORT, it adds the &lt;BR /&gt;
revenues and expenses together - for example (the break is on account &lt;BR /&gt;
type): &lt;BR /&gt;
&lt;BR /&gt;
                 Fund A         Fund B           Fund C&lt;BR /&gt;
&lt;BR /&gt;
Sales  $15,000               $4,000             $10,000&lt;BR /&gt;
Service  $6,000              $11,000           -$4,000&lt;BR /&gt;
&lt;B&gt;Revenue   $21,000       $15,000         $6,000&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Administrative   $20,000       $15,000        --&lt;BR /&gt;
Professional      $36,896      $10,000       $5,000&lt;BR /&gt;
&lt;B&gt;Salaries   $56,896.56   $25,000        $5,000&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
Coffee            $17,724         $5,000       $1,000&lt;BR /&gt;
Supplies           --                $5,000       $2,333&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;Expenses $17,724.42     $10,000         $3,333&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;&lt;I&gt;RBREAK Summary $95,620.98      $50,000    $14,333&lt;/I&gt;&lt;/B&gt;&lt;I&gt;&lt;/I&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I want to subtract expenses from revenue for the summary line.  Is &lt;BR /&gt;
there an easy way, or a compute block method, to do this?  I have &lt;BR /&gt;
eight columns for different funds, and am generating ODS PDF output. &lt;BR /&gt;
I can make it work if I make my expenses negative, but I want them to &lt;BR /&gt;
show as positive on the financial statement. &lt;BR /&gt;
&lt;BR /&gt;
For example, on the above, I want the following result on the left column of values:&lt;BR /&gt;
&lt;BR /&gt;
Revenue   $21,000 &lt;BR /&gt;
Salaries   $56,896.56 &lt;BR /&gt;
RBREAK Summary $35,896.56 &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I would like to know if I can accomplish this in PROC REPORT, or if I need to conduct further data pre-processing, etc.  (It seems more appropriate for PROC COMPUTAB, but that is not present in our Base 9.3.1 install.)  Thanks for your help, &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Will try not to bother the forum in the future -- after Googling for two days, I'm out of ideas, which makes me think it's a simple oversight...&lt;BR /&gt;
&lt;BR /&gt;
Jason Browning &lt;BR /&gt;
Controller &lt;BR /&gt;
Lake Superior State University</description>
      <pubDate>Thu, 21 Oct 2010 18:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20662#M3809</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-10-21T18:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Compute Blocks</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20663#M3810</link>
      <description>Hi:&lt;BR /&gt;
  Could you make your expense field negative numbers??? That would be simplest -- otherwise, you're right, you'd need to use a COMPUTE block (or 2 or 3) to alter the values at the RBREAK. I'm not at my computer now, but to do this in a COMPUTE block, you'd have to grab and save the FUND totals for expenses at the appropriate break line (save into a temporary variable) and then subtract the saved number from the total at the RBREAK line.&lt;BR /&gt;
 &lt;BR /&gt;
  PROC REPORT has an automatic variable called _BREAK_ that you can test in the compute block. There are examples of testing _BREAK_ for things like writing custom break lines ... probably not so many for adjusting the total. When I get back to my computer I will look for an example. How do you determine what Account belongs to what group (Revenue vs Expenses)?? Are there NOPRINT variables that you are using? Can you show your REPORT code??&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 21 Oct 2010 18:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20663#M3810</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-21T18:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Compute Blocks</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20664#M3811</link>
      <description>Hi Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
Unfortunately, I can't display negative numbers on the financial statement (regulatory issue).  That's why I'm confused. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;  I've read several proceeding papers on creating ucstom break lines (text, for example), but none that indicate how to adjust the totals in each column.&lt;BR /&gt;
&lt;BR /&gt;
Here is the code I'm using at present.  It's the ACCT_TYPE variable (which is NOPRINT) that lets me determine what is a revenue (5) and what is an expense (others).&lt;BR /&gt;
&lt;BR /&gt;
 PROC FORMAT;&lt;BR /&gt;
   value $acct_type&lt;BR /&gt;
   5 = 'Revenues'&lt;BR /&gt;
   6 = 'Salaries and fringes'&lt;BR /&gt;
   7 = 'Expenses'&lt;BR /&gt;
   8 = 'Transfers'&lt;BR /&gt;
&lt;BR /&gt;
   value $fund_type&lt;BR /&gt;
   '85000U' = 'LSSU Fndn'&lt;BR /&gt;
   '85001U' = 'Unrstrctd Gfts'&lt;BR /&gt;
   '85020U' = 'Cooper Golf Classic'&lt;BR /&gt;
   '85021U' = 'Lake State Golf Classic'&lt;BR /&gt;
   '85030U' = 'Phonathon'&lt;BR /&gt;
   '87001T' = 'Laker Club'&lt;BR /&gt;
   '88303T' = 'Aquatic Lab'&lt;BR /&gt;
   '85514T' = 'SBELS Bldg Cmpgn'&lt;BR /&gt;
   '85516T' = 'ARL Building'&lt;BR /&gt;
   'OTH86'  = 'Total Fdn Endwmnts'&lt;BR /&gt;
   'OTHALL' = 'All Other';&lt;BR /&gt;
&lt;BR /&gt;
   RUN;&lt;BR /&gt;
&lt;BR /&gt;
proc report data=FIN_CALC_NOSIGN nowd;&lt;BR /&gt;
 column ACCT_TYPE FGBOPAL_ACCT_CODE FTVACCT_TITLE FUNDGROUP,SUM_AMOUNT ROW_SUM;&lt;BR /&gt;
define FUNDGROUP / group ' ' across format=$fund_type. ORDER=internal Style={cellwidth=.52in};&lt;BR /&gt;
 define ACCT_TYPE / group ' ' missing noprint format=$acct_type. ORDER=Internal;&lt;BR /&gt;
 compute before ACCT_TYPE / style=[just=l font=("Times New Roman",9pt,bold)];&lt;BR /&gt;
  text1=(put(ACCT_TYPE,$acct_type.));&lt;BR /&gt;
 line text1 $;&lt;BR /&gt;
endcomp;&lt;BR /&gt;
 define FGBOPAL_ACCT_CODE / group ' ' format=$5. missing order=internal ;&lt;BR /&gt;
define FTVACCT_TITLE / group 'Account' ;&lt;BR /&gt;
define SUM_AMOUNT / ANALYSIS SUM ' ' missing format=comma14.2 ;&lt;BR /&gt;
define ROW_SUM / 'Total' COMPUTED format=comma14.2;&lt;BR /&gt;
&lt;BR /&gt;
break after ACCT_TYPE / summarize;&lt;BR /&gt;
rbreak after / summarize;  &lt;BR /&gt;
&lt;BR /&gt;
COMPUTE ROW_SUM; ROW_SUM = SUM(_C4_,_C5_,_C6_,_C7_,_C8_,_C9_,_C10_,_C11_,_C12_,_C13_,_C14_,_C15_,_C16_); ENDCOMP;&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
If it is possible, I would like to contain it within PROC REPORT.  It seems difficult to add a changing number of columns using the object-oriented report writing (which I love otherwise).  Maybe stacking tables?&lt;BR /&gt;
&lt;BR /&gt;
I appreciate any guidance!&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Jason</description>
      <pubDate>Thu, 21 Oct 2010 19:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20664#M3811</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-10-21T19:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Compute Blocks</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20665#M3812</link>
      <description>Hi:&lt;BR /&gt;
  This is the only example that I had on a USB drive -- I'm not at my computer right now. So you can sort of see a number changing for an ACROSS column's value at the break, but it's just an arbirtary change. You can see that at the RBREAK, I am changing the value of HEIGHT to 111 for the Female HEIGHT summary and the value 222 to the Male HEIGHT summary. (I put HEIGHT on the report twice so you could see the originally calculated values versus the changed values.&lt;BR /&gt;
 &lt;BR /&gt;
For what you need to do, you'd have to grab the numbers to subtract (into temporary variables, like I have HOLDF and HOLDM) at the compute after account -- and then at the RBREAK you'd use the "held values" to subtract.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
 [pre]&lt;BR /&gt;
proc report data=sashelp.class nowd;&lt;BR /&gt;
  column age n ('Changed RBREAK Value' sex,height)&lt;BR /&gt;
               ('REPORT Calc RBREAK Value' sex,height=htdup);&lt;BR /&gt;
  define age / group;&lt;BR /&gt;
  define sex / across;&lt;BR /&gt;
  define height /sum;&lt;BR /&gt;
  define htdup / sum;&lt;BR /&gt;
  rbreak after / summarize;&lt;BR /&gt;
  compute before;&lt;BR /&gt;
     holdF = 111;&lt;BR /&gt;
     holdM = 222;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute height;&lt;BR /&gt;
    if _break_ = '_RBREAK_' then do;&lt;BR /&gt;
        ** change the value on the break line;&lt;BR /&gt;
        ** can put more complicated calcs here;&lt;BR /&gt;
        _c3_ = holdF;&lt;BR /&gt;
        _c4_ = holdM;&lt;BR /&gt;
    end;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 21 Oct 2010 20:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20665#M3812</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-21T20:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Compute Blocks</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20666#M3813</link>
      <description>That looks like what I'm trying to accomplish.  However, the number of columns can vary in any given month/quarter, as our funds and activities change (there is a different column for each donor scholarship, for example).&lt;BR /&gt;
&lt;BR /&gt;
I've been experimenting with trying to incorporate a macro within a compute statement that would count the number of columns (which would be the number of unique FUNDGROUP codes) and then perform a calculation for each.  This seems to be more complicated than I am familiar with, however...  Any ideas on how we might make it dynamic?  If not, I can hard-code.&lt;BR /&gt;
&lt;BR /&gt;
Thanks so much for pointing me in the right direction!</description>
      <pubDate>Fri, 22 Oct 2010 13:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20666#M3813</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-10-22T13:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Compute Blocks</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20667#M3814</link>
      <description>Hi:  &lt;BR /&gt;
You are lucky that someone has already written a similar macro. You will find it in this paper -- &lt;A href="http://support.sas.com/rnd/papers/sgf07/sgf2007-report.pdf" target="_blank"&gt;http://support.sas.com/rnd/papers/sgf07/sgf2007-report.pdf&lt;/A&gt; starting on page 12/13.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 22 Oct 2010 13:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20667#M3814</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-22T13:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Report Compute Blocks</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20668#M3815</link>
      <description>That is the best news all day!  Thanks, Cynthia &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 22 Oct 2010 14:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-Report-Compute-Blocks/m-p/20668#M3815</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-10-22T14:20:52Z</dc:date>
    </item>
  </channel>
</rss>

