<?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 BEFORE _PAGE_ in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165584#M42910</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Cynthia,&lt;/P&gt;&lt;P&gt;It very helpful! Now it makes sense that COMPUTE BEFORE _PAGE_ reports only the first row in a BY-GROUP. And for my purpose it is not a limitation - it is a bonus! Because I've got other variables which hold all the information I need in each row. So I can just use those variables instead.&lt;/P&gt;&lt;P&gt;Thanks again, BEFORE _PAGE_ mystery solved.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Nov 2014 03:57:57 GMT</pubDate>
    <dc:creator>VS</dc:creator>
    <dc:date>2014-11-12T03:57:57Z</dc:date>
    <item>
      <title>Proc report - COMPUTE BEFORE _PAGE_</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165579#M42905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I sent my question a few days ago (without data and a full code) about my problem with COMPUTE BEFORE block in PROC REPORT.&lt;/P&gt;&lt;P&gt;When I used just COMPUTE BEFORE, calculated fields were correct but displayed between data and row headings. I found in some article that to get them in the right place (above the data) I had to use COMPUTE BEFORE _PAGE_. However, when I did that the fields moved to the right place, but the calculated values did not display.&lt;/P&gt;&lt;P&gt;As Cynthia suggested, I've attached my code and test data.&lt;/P&gt;&lt;P&gt;I will appreciate any advice re my problem and any other suggestions about the code.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Victoria&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 05:19:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165579#M42905</guid>
      <dc:creator>VS</dc:creator>
      <dc:date>2014-11-11T05:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - COMPUTE BEFORE _PAGE_</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165580#M42906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Code worked for me . It looks like f2 f3 date2_1 ......... they are all missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data class;set sashelp.class;run;
proc sort data=class;by sex;run;

proc report data=class nowd;
by sex;
columns name age height weight ;
define name/display ;
define age/display ;
define height/analysis sum noprint;
define weight/analysis sum noprint;
compute before _page_;
line 'height' height.sum;
line 'weight' weight.sum;
endcomp;
run;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 13:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165580#M42906</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-11T13:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - COMPUTE BEFORE _PAGE_</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165581#M42907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; Thanks for the code. You left off some of the required pieces, like the user-defined formats and the %RGB macro. But a quick look at your data does reveal that many of the date fields that you are trying to use in your COMPUTE BEFORE are all missing values. But, as Xia's example shows, in practice, with different data, the values for a summarized analysis item are available in the COMPUTE BEFORE _PAGE_. The only conclusion possible is that you have a problem with your data or your assumptions about the data. Here's what I see when I look at the data file you sent. F2 and F3 that you are trying to display at the COMPUTE are all missing and the DATE variables you are trying to display at the COMPUTE are all missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I'd recommend taking a step back and getting the COMPUTE BEFORE _PAGE_ working for a simpler example and then trying a more complex example. Or, you could try working with Tech Support, but I would really recommend taking a closer look at the data and the pre-processing data manipulation you're trying to do. Somehow, I don't think that you are accomplishing what you want to accomplish. And, in looking at your data file, it's not obvious what you are trying to achieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10814i6F581A6831E03058/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="missing_values_in_test_data.png" title="missing_values_in_test_data.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 15:20:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165581#M42907</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2014-11-11T15:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - COMPUTE BEFORE _PAGE_</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165582#M42908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I must be definitely missing something. As I can see it, data for dates and F2 and F3 is not missing. For example, there is a valid date and a corresponding F3&amp;nbsp; in row 106 (can be seen in Cynthia's image). Also there are values in rows 18, 61 and 74. My understanding is that COMPUTE block computes within BY-GROUP. In my case, within each BY-GROUP section there is at least one flag and a date associated with it. &lt;/P&gt;&lt;P&gt;With COMPUTE BEFORE, this precisely data gives me the correct result as in the first picture below,&amp;nbsp; but in a 'wrong' place .&lt;/P&gt;&lt;P&gt;The second image - with COMPUTE BEFORE _PAGE_ - shows all the text information in the 'right place', but the computed values are no longer there.&lt;/P&gt;&lt;P&gt;So I am not accomplishing what I want to accomplish, but I still cannot see why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Image 1: With COMPUTE BEFORE&lt;/P&gt;&lt;P&gt;&lt;IMG alt="INF_Hosp1 with BEFORE.PNG" class="jive-image jiveImage" height="358" src="https://communities.sas.com/legacyfs/online/7865_INF_Hosp1 with BEFORE.PNG" width="267" /&gt; &lt;/P&gt;&lt;P&gt;Image 2: With COMPUTE BEFORE _PAGE_&lt;/P&gt;&lt;P&gt;&lt;IMG alt="AMI_Hosp1 - with BEFORE _PAGE_.PNG" class="jive-image" height="296" src="https://communities.sas.com/legacyfs/online/7866_AMI_Hosp1 - with BEFORE _PAGE_.PNG" width="255" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 22:46:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165582#M42908</guid>
      <dc:creator>VS</dc:creator>
      <dc:date>2014-11-11T22:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - COMPUTE BEFORE _PAGE_</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165583#M42909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I was expecting to see a date on every row and considered it an error condition that there weren't more values. And, asking for any date.sum to be be used in a LINE doesn't make sense to me. Also, since there ARE fields with a 1 on every row for the Number value, I wondered whether the wrong column was being number of LL2 and LL3 flags. And, even if the COMPUTE BEFORE break-var does shown something for the date1 field, there is nothing for date2 and date3, which was what led me to believe that all 3 date values were wrong or off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PROC REPORT goes through a pre-processing summarization phase when it starts. I'm not sure whether you've stumbled on a timing issue or not. Consider the code that simplifies the example and output it produces shown in the screen shot below. Clearly, what is available for COMPUTE BEFORE _PAGE_ is different than the COMPUTE BEFORE or COMPUTE AFTER. This may be PROC REPORT working as designed. In which case, the OP needs to come up with a different solution what they are trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data testit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; set sashelp.class;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; where age in (13, 14, 15);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if sex = 'M' then numboy = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else if sex = 'F' then numgirl = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html file='c:\temp\testit.html';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc report data=testit nowd&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; style(summary)=Header;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; column age sex numboy numgirl name height weight;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define age / order;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; break after age / summarize;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; rbreak after / summarize;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; compute before _page_;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Compute before _page_';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Numboy = ' numboy.sum comma3.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Numgirl = ' numgirl.sum comma3.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Height = ' height.sum comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Weight = ' weight.sum comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; compute after;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Compute before _page_';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Numboy = ' numboy.sum comma3.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Numgirl = ' numgirl.sum comma3.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Height = ' height.sum comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Weight = ' weight.sum comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; compute before;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Compute before _page_';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Numboy = ' numboy.sum comma3.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Numgirl = ' numgirl.sum comma3.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Height = ' height.sum comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line 'Weight = ' weight.sum comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html close;&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11412i6823D404EB74B27A/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="show_compute_before_page_avail.png" title="show_compute_before_page_avail.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 03:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165583#M42909</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2014-11-12T03:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - COMPUTE BEFORE _PAGE_</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165584#M42910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Cynthia,&lt;/P&gt;&lt;P&gt;It very helpful! Now it makes sense that COMPUTE BEFORE _PAGE_ reports only the first row in a BY-GROUP. And for my purpose it is not a limitation - it is a bonus! Because I've got other variables which hold all the information I need in each row. So I can just use those variables instead.&lt;/P&gt;&lt;P&gt;Thanks again, BEFORE _PAGE_ mystery solved.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 03:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-COMPUTE-BEFORE-PAGE/m-p/165584#M42910</guid>
      <dc:creator>VS</dc:creator>
      <dc:date>2014-11-12T03:57:57Z</dc:date>
    </item>
  </channel>
</rss>

