<?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: Printing report pages according to value within report page. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67561#M19338</link>
    <description>Hi Cynthia and thanks for the feedback.  I actually have some programs that use the $varying option but most of these are looking for something within 1 or 2 records.  The task I am working with is unusual because it requires me to build the entire page and then deciding whether to keep it or reject.&lt;BR /&gt;
I have searched the archives a bit but it was hard to find the right expression to search on.  I will take your suggestion and do some more searching to see if I can find something useful.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Gil.</description>
    <pubDate>Sun, 14 Mar 2010 01:00:07 GMT</pubDate>
    <dc:creator>HoustonGSC</dc:creator>
    <dc:date>2010-03-14T01:00:07Z</dc:date>
    <item>
      <title>Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67555#M19332</link>
      <description>Does SAS have the capability to look at a z/os print dataset and address an entire page versus individual lines.&lt;BR /&gt;
I need to be able to extract certain pages if they match a certain criteria.&lt;BR /&gt;
&lt;BR /&gt;
The selection criteria is located about 3-4 lines into the report so I have to be able to build an entire page first to know whether I want to keep that page or not.&lt;BR /&gt;
&lt;BR /&gt;
Any ideas would be greatly appreciated.</description>
      <pubDate>Thu, 11 Mar 2010 19:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67555#M19332</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-11T19:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67556#M19333</link>
      <description>The z/OS (IBM mainframe) SYSOUT-directed report or output may have a non-blank character in column 1.&lt;BR /&gt;
&lt;BR /&gt;
The straight answer to your question is no -- there is no magic here.&lt;BR /&gt;
&lt;BR /&gt;
However, you may consider reading an SYSOUT-type output using a DATA step, keeping a variable counter as you move to successive new pages, to create a temporary SAS (or temporary sequential file).  Then using your own filtering/subsetting criteria, identify what page(s) need to be saved/copied/printed or whatever, in your SAS program.&lt;BR /&gt;
&lt;BR /&gt;
Also, I would suggest that this type of external data (report) processing is not necessarily unique to any given OS platform.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Google advanced search argument, this topic/post:&lt;BR /&gt;
&lt;BR /&gt;
data step programming reading external data site:sas.com</description>
      <pubDate>Thu, 11 Mar 2010 19:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67556#M19333</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-11T19:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67557#M19334</link>
      <description>That was along the lines I was thinking as well, I can build a page by writing all the line records to a temporary sas dataset and then during new page logic, either dump the temporary dataset to a print file if the page contains the criteria desired or clear/delete the temporary dataset if it does not.&lt;BR /&gt;
I do not work with SAS on a daily basis and it has been probably over a year since I've had to code a new program.&lt;BR /&gt;
Would I use PROC DATASETS to copy the temp dataset to the print file and then delete it?  Or would PROC PRINTTO work?  Note sure what would be the best method to dump the contents of the temp dataset and then clear it?</description>
      <pubDate>Fri, 12 Mar 2010 13:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67557#M19334</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-12T13:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67558#M19335</link>
      <description>No PROC supports writing/reading this type of external SYSOUT-related file.  You will need to use a SAS DATA step with INFILE &lt;FILEREF&gt; pointing to an external file where you have captured the SYSOUT report (to a dataset, not a JES-managed SYSOUT=  location).  For this exercise, all processing will need to be hand-coded.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/FILEREF&gt;</description>
      <pubDate>Fri, 12 Mar 2010 14:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67558#M19335</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-12T14:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67559#M19336</link>
      <description>Understood, the sysout has already been captured to a file on the MF and I have it defined as an INFILE to a data step.  I have everything coded but just needed some help on how to process the temporary datasets.&lt;BR /&gt;
I will figure it out as I always do.</description>
      <pubDate>Fri, 12 Mar 2010 14:24:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67559#M19336</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-12T14:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67560#M19337</link>
      <description>Hi:&lt;BR /&gt;
  Long ago, in a galaxy far, far away, when I worked in a MF shop, the only historical record for some reports was the MF SYSOUT file -- with carriage controls and all. We used to routinely "scrape" the MF SYSOUT file with DATA step programs (INFILE/INPUT) for report information so we could compare this year's info to 12 years ago.&lt;BR /&gt;
 &lt;BR /&gt;
  One good trick is to use $VARYING and to read each line as a huge character string. If you use the LENGTH= option on the INFILE statement, you can detect "empty" lines, because the LENGTH variable will be 0 for those lines. Then you can parse the line looking for your text of interest. Or, you might know that a column header is always spelled: YRLY AMT -- so when you find that, you know that the line immediately -after- that line is where your data begins. The single trailing @ is a big help here, because you can hold a line while you figure out whether you want it and then because MF report generally have spaces between pieces of information or (in the old days) characters like '|' between columns, you could then re-read the line with list input to parse out what you want.&lt;BR /&gt;
 &lt;BR /&gt;
  There may not be any programs hanging out anymore that explain report scraping, but people still do parse the SAS log for error messages, so you might want to search through SAS user group papers for how to read a "captured" SAS log file with a program.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 12 Mar 2010 16:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67560#M19337</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-03-12T16:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67561#M19338</link>
      <description>Hi Cynthia and thanks for the feedback.  I actually have some programs that use the $varying option but most of these are looking for something within 1 or 2 records.  The task I am working with is unusual because it requires me to build the entire page and then deciding whether to keep it or reject.&lt;BR /&gt;
I have searched the archives a bit but it was hard to find the right expression to search on.  I will take your suggestion and do some more searching to see if I can find something useful.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Gil.</description>
      <pubDate>Sun, 14 Mar 2010 01:00:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67561#M19338</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-14T01:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67562#M19339</link>
      <description>Hi:&lt;BR /&gt;
   I'd be tempted to build one observation per page, using an array so each line on the page would be one huge character string...something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
array ln $200 ln1-ln60;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
Then you could use a DO loop to zip through each page, because each page is an obs and then you could set a yes/no flag variable about whether you want this page or not. Depending on the MF report, your SYSOUT file is usually 132 or 133 characters "wide" (linesize) by 55-60 lines "long" (Pagesize) -- so unless your report is thousands of pages, the time to DO loop over every obs won't be too bad. Then if your DO loop logic reveals whether to keep the page or not, you can either "unarray" in a separate Data step or in the same Data step to create the final report.&lt;BR /&gt;
&lt;BR /&gt;
I still don't understand the "build the page" and then keep or reject it scenario??? If you are scraping a MF report, the report is already built. Do you need to rebuild it a second time??? &lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sun, 14 Mar 2010 19:26:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67562#M19339</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-03-14T19:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67563#M19340</link>
      <description>This sounds very interesting.  I have taken a few vacation days off but when I return I will look at doing something like what you describe.  The lrecl=161 and the report is only several hundred pages.&lt;BR /&gt;
The reason I say I have to "build the page" is because if a page contains 60 records, the entire 60 records are "tied" together.  They are either accepted or rejected as a whole.&lt;BR /&gt;
I should know whether I want to keep the page or not by about the 4th record, however, I can't just stop my processing if the record is not a match.  I have to continue to process the remaining records until a new form feed is found.  At that point, I can discard all of the previous records and then start again.&lt;BR /&gt;
&lt;BR /&gt;
I would appreciate any examples (or links) of what you described above if you have any on hand.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Gil.</description>
      <pubDate>Mon, 15 Mar 2010 13:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67563#M19340</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-15T13:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67564#M19341</link>
      <description>Can you provide more specific information about the contents and record format.&lt;BR /&gt;
&lt;BR /&gt;
For example if each page is PS records then you can easily read each line into and enumerated list of variables (array).  Then figure out if you want it or not.&lt;BR /&gt;
&lt;BR /&gt;
If each page has to be determined by ANSI carriage control then you have to check the CC column and process accordingly.  You would still need an enumerated list of variables.  But the way you fill it is different.  Plus as you fill the variable list you can decide if the page is needed and “short circuit” to the start of the next page.&lt;BR /&gt;
&lt;BR /&gt;
Here is example that may be helpful...  My OS is Winders so you may need different INFILE and FILE statement options.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename FT15F001 temp recfm=V;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
   infile FT15F001 length=l eof=eof;&lt;BR /&gt;
   array line[10] $80;&lt;BR /&gt;
   do _n_ = 1 by 1 until(cc eq '1');&lt;BR /&gt;
      input line[_n_] $varying80. l @;&lt;BR /&gt;
      if indexw(line[_n_],'bad') then do;&lt;BR /&gt;
         do until(cc eq '1');&lt;BR /&gt;
            input / cc $varying1. l @;&lt;BR /&gt;
            end;&lt;BR /&gt;
         input @1 @@;&lt;BR /&gt;
         delete;&lt;BR /&gt;
         end;&lt;BR /&gt;
      input / cc $varying1. l @1 @;&lt;BR /&gt;
      end;&lt;BR /&gt;
  eof:&lt;BR /&gt;
   file print noprint;&lt;BR /&gt;
   do _n_ = 1 to dim(line);&lt;BR /&gt;
      l = length(line[_n_]);&lt;BR /&gt;
      put line[_n_] $varying80. l;&lt;BR /&gt;
      end;&lt;BR /&gt;
   parmcards;&lt;BR /&gt;
1This is page 1&lt;BR /&gt;
 This is a bad page&lt;BR /&gt;
 more stuff&lt;BR /&gt;
0more stuff&lt;BR /&gt;
 more stuff&lt;BR /&gt;
 more stuff&lt;BR /&gt;
 end of page&lt;BR /&gt;
1This is page 2&lt;BR /&gt;
0This is a good page badly&lt;BR /&gt;
-more stuff&lt;BR /&gt;
 more stuff&lt;BR /&gt;
 more stuff&lt;BR /&gt;
 end of page&lt;BR /&gt;
1This is page 3&lt;BR /&gt;
 more stuff&lt;BR /&gt;
 This is a bad page&lt;BR /&gt;
 end of page&lt;BR /&gt;
1This is page 4&lt;BR /&gt;
0more stuff&lt;BR /&gt;
 This is a Good page&lt;BR /&gt;
0more stuff&lt;BR /&gt;
 more stuff&lt;BR /&gt;
 end of page&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Mon, 15 Mar 2010 14:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67564#M19341</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-03-15T14:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67565#M19342</link>
      <description>Sorry for the late response, just got back from spring break with the kiddos.&lt;BR /&gt;
&lt;BR /&gt;
The lrecl=161 and recfm=fba and it is a ps file.&lt;BR /&gt;
&lt;BR /&gt;
The first 72 characters of the first few records look like this :&lt;BR /&gt;
&lt;BR /&gt;
1  $$DJDE JDE=STD15,SIDE=(NUFRONT,NOFFSET),END;                         &lt;BR /&gt;
  JNM: GSGB020                            P R I V A T E   L A B E L     &lt;BR /&gt;
  PGM: GSGB020      &lt;B&gt;BOOK A&lt;/B&gt;                 G R O U P   B U Y   O R D E R&lt;BR /&gt;
0                                                                       &lt;BR /&gt;
                                                                        &lt;BR /&gt;
                                                                        &lt;BR /&gt;
                                                                      CA&lt;BR /&gt;
   ITEM     PACK  SIZE        DESCRIPTION             O.I.   REBATE   CO&lt;BR /&gt;
                                                                        &lt;BR /&gt;
0                  0001   PRIVATE LABEL MANDARIN ORANGES                &lt;BR /&gt;
                                                                        &lt;BR /&gt;
&lt;BR /&gt;
The variable string I am looking for is the &lt;B&gt;BOOK A&lt;/B&gt; string.&lt;BR /&gt;
&lt;BR /&gt;
I have worked with arrays in perl and VB script but not in SAS so forgive me if I am not reading your logic correctly.&lt;BR /&gt;
&lt;BR /&gt;
It looks like you are reading the first 10 variables into an array (I'm guessing that a space is the delimiter) and then searching each array item and looking for the target string.&lt;BR /&gt;
If you find the string then you keep the line but you delete the line if target string not found.&lt;BR /&gt;
&lt;BR /&gt;
Is this correct? Or are you reading the first 10 lines into an array?</description>
      <pubDate>Mon, 22 Mar 2010 12:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67565#M19342</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-22T12:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67566#M19343</link>
      <description>Based on the new info you provided I have changed the program to read each line of each page into an array LINE&lt;LI&gt; and if “BOOK A” is found then the page is kept.  This is a bit simpler than my other program.  &lt;BR /&gt;
&lt;BR /&gt;
Yes, each line of each page is read into the LINE array.  There is only one page at time in the array, and then if it is a good page it is printed.  If you know exactly where the KEEP info is you can short circuit the reading similar to my original program.  &lt;BR /&gt;
&lt;BR /&gt;
The elements of the LINE array are variables.  The value of each variable is the entire contents of a line.  I don't know if I answered all your questions.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
   infile FT15F001 length=l eof=eof;&lt;BR /&gt;
   array line[20] $161; *array dim should equal report page size;&lt;BR /&gt;
   keeperFlag = 0;&lt;BR /&gt;
   do _n_ = 1 by 1 until(cc eq '1');&lt;BR /&gt;
      input @1 line[_n_] $char161. @@;&lt;BR /&gt;
      putlog _infile_;&lt;BR /&gt;
      if not keeperFlag then if index(line[_n_],'BOOK A') then keeperFlag = 1;&lt;BR /&gt;
      input / @1 cc $1. @@;&lt;BR /&gt;
      end;       &lt;BR /&gt;
  eof:&lt;BR /&gt;
   file print noprint ls=161;&lt;BR /&gt;
   if keeperFlag then do _n_ = 1 to dim(line);&lt;BR /&gt;
      put line[_n_] $char161.;&lt;BR /&gt;
      end;&lt;BR /&gt;
   parmcards4;&lt;BR /&gt;
1$$DJDE JDE=STD15,SIDE=(NUFRONT,NOFFSET),END; &lt;BR /&gt;
 JNM: GSGB020 P R I V A T E L A B E L &lt;BR /&gt;
 PGM: GSGB020 BOOK A G R O U P B U Y O R D E R&lt;BR /&gt;
0 &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
 CA&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
&lt;BR /&gt;
0 0001 PRIVATE LABEL MANDARIN ORANGES &lt;BR /&gt;
1$$DJDE JDE=STD15,SIDE=(NUFRONT,NOFFSET),END; &lt;BR /&gt;
 JNM: GSGB020 P R I V A T E L A B E L &lt;BR /&gt;
 PGM: GSGB020 BOOK B G R O U P B U Y O R D E R&lt;BR /&gt;
0 &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
 CA&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
&lt;BR /&gt;
0 0002 PRIVATE LABEL MANDARIN ORANGES &lt;BR /&gt;
1$$DJDE JDE=STD15,SIDE=(NUFRONT,NOFFSET),END; &lt;BR /&gt;
 JNM: GSGB020 P R I V A T E L A B E L &lt;BR /&gt;
 PGM: GSGB020 BOOK A G R O U P B U Y O R D E R&lt;BR /&gt;
0 &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
 CA&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
&lt;BR /&gt;
0 0003 PRIVATE LABEL MANDARIN ORANGES &lt;BR /&gt;
1$$DJDE JDE=STD15,SIDE=(NUFRONT,NOFFSET),END; &lt;BR /&gt;
 JNM: GSGB020 P R I V A T E L A B E L &lt;BR /&gt;
 PGM: GSGB020 BOOK C G R O U P B U Y O R D E R&lt;BR /&gt;
0 &lt;BR /&gt;
&lt;BR /&gt;
 CA&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
&lt;BR /&gt;
0 0004 PRIVATE LABEL MANDARIN ORANGES &lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]&lt;/LI&gt;</description>
      <pubDate>Mon, 22 Mar 2010 17:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67566#M19343</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-03-22T17:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67567#M19344</link>
      <description>Thanks for your feedback, it has been extremely helpful!&lt;BR /&gt;
&lt;BR /&gt;
It's taken me a little while to look at the code and review the usage notes for arrays and macros but I think I finally understand most of what you and Cynthia were getting at.  &lt;BR /&gt;
&lt;BR /&gt;
I have included the code below and it is almost working as desired.  &lt;BR /&gt;
&lt;BR /&gt;
The problem I am running into is that the print file has already been created and there are not a fixed number of lines per page.  They vary according to the number of detail lines.&lt;BR /&gt;
&lt;BR /&gt;
If I specify an array number that is the max number of lines per page, then if there are less than this amount, it fills the page with blank lines at the end so it is not a true copy of the original file.&lt;BR /&gt;
&lt;BR /&gt;
I tried specifying an array LINE{*} but this gives me the error:&lt;BR /&gt;
The array LINE has been defined with zero elements&lt;BR /&gt;
&lt;BR /&gt;
Is it possible to track the number of lines per page (CC=1) and then pass this to the array definition or something like that?&lt;BR /&gt;
&lt;BR /&gt;
//STEP17   EXEC SASPROC                                    &lt;BR /&gt;
//SASIN    DD DISP=SHR,DSN=PL.DISK.GSGB020B.GRPBUY.BOOKS(0)&lt;BR /&gt;
//BKS2PRT DD *                                             &lt;BR /&gt;
  BOOKA                                                    &lt;BR /&gt;
  BOOKB                                                    &lt;BR /&gt;
  BOOKC                                                   &lt;BR /&gt;
  BOOKZ                                                   &lt;BR /&gt;
//SASLIST  DD SYSOUT=A                   &lt;BR /&gt;
//SYSIN    DD * &lt;BR /&gt;
  OPTIONS MPRINT MLOGIC SYMBOLGEN;            &lt;BR /&gt;
  /**********************************************************/&lt;BR /&gt;
  /* STORE BOOKS TO PRINT AS MACRO VARIABLES */&lt;BR /&gt;
  /**********************************************************/&lt;BR /&gt;
  DATA _NULL_;                                &lt;BR /&gt;
  INFILE BKS2PRT LENGTH=CARDIN END=EOF;       &lt;BR /&gt;
  DO _N_ = 1 BY 1 UNTIL(EOF);                 &lt;BR /&gt;
  INPUT @1 ABKS2PRT $VARYING80. CARDIN ;      &lt;BR /&gt;
  CALL SYMPUT(CATS(ABKS2PRT), CATS(ABKS2PRT));&lt;BR /&gt;
  END;                                        &lt;BR /&gt;
  RUN;                                        &lt;BR /&gt;
  /******************************************************/ &lt;BR /&gt;
  /* PRINT ONLY THE BOOKS SPECIFIED IN THE   */ &lt;BR /&gt;
  /* BKS2PRT FILE ABOVE.                                    */ &lt;BR /&gt;
  /******************************************************/ &lt;BR /&gt;
  DATA _NULL_ ;                                        &lt;BR /&gt;
  INFILE SASIN LENGTH=RECLEN EOF=EOF;                  &lt;BR /&gt;
  ARRAY LINE{66} $161 ;                                &lt;BR /&gt;
  KEEPERFLAG = 0;                                      &lt;BR /&gt;
  DO _N_ = 1 BY 1 UNTIL(CC EQ '1');                    &lt;BR /&gt;
  INPUT @1 LINE{_N_} $CHAR161. @@;                     &lt;BR /&gt;
  IF NOT KEEPERFLAG THEN                               &lt;BR /&gt;
  DO;                                                  &lt;BR /&gt;
  PGMID=INDEX(LINE{_N_},'PGM: GSGB020 ');              &lt;BR /&gt;
    IF PGMID GT 0 THEN                                 &lt;BR /&gt;
    DO;                                                &lt;BR /&gt;
    BOOKID = SUBSTR(LINE{_N_}, PGMID+23, 1);           &lt;BR /&gt;
    BOOKS2PRT = '&amp;amp;BOOK'||BOOKID;                       &lt;BR /&gt;
    CURBOOK = 'BOOK'||BOOKID;                          &lt;BR /&gt;
    IF CURBOOK = RESOLVE(BOOKS2PRT) THEN KEEPERFLAG= 1;&lt;BR /&gt;
    END;                                               &lt;BR /&gt;
  END;                                                 &lt;BR /&gt;
  INPUT / @1 CC $1. @@;                                &lt;BR /&gt;
  END;                                                 &lt;BR /&gt;
  EOF:                                                 &lt;BR /&gt;
  FILE PRINT NOPRINT LS=161;                 &lt;BR /&gt;
  IF KEEPERFLAG THEN DO _N_ = 1 TO DIM(LINE);&lt;BR /&gt;
  PUT LINE{_N_} $CHAR161.;                   &lt;BR /&gt;
  END;                                       &lt;BR /&gt;
  RUN;</description>
      <pubDate>Thu, 25 Mar 2010 16:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67567#M19344</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-25T16:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67568#M19345</link>
      <description>_N_ is being used to count lines as each page is read.  &lt;BR /&gt;
&lt;BR /&gt;
This value should be 1 larger than the number of lines read for a KEEPER.  One more because the first line of the "next" page is read unless the page is also at end of file in which case you don't want to subtract one.&lt;BR /&gt;
&lt;BR /&gt;
Add the END= option to the INFILE statement e.g.&lt;BR /&gt;
&lt;BR /&gt;
[pre] infile FT15F001 length=l eof=eof &lt;I&gt;&lt;B&gt;end=eof&lt;/B&gt;&lt;/I&gt;;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Also with FIXED length records the INFILE option LENGTH is not necessary I forgot to remove it when I changed the example to fixed records.&lt;BR /&gt;
&lt;BR /&gt;
and change this line &lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
IF KEEPERFLAG THEN DO _N_ = 1 TO DIM(LINE);&lt;BR /&gt;
[/pre]&lt;BR /&gt;
to &lt;BR /&gt;
[pre]&lt;BR /&gt;
IF KEEPERFLAG THEN DO _N_ = 1 TO &lt;I&gt;&lt;B&gt;_n_ - (not eof)&lt;/B&gt;&lt;/I&gt;;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
should produce the desired result.</description>
      <pubDate>Thu, 25 Mar 2010 17:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67568#M19345</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-03-25T17:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67569#M19346</link>
      <description>Thanks, that just about did it.  &lt;BR /&gt;
&lt;BR /&gt;
Everything looked good except the last line of the page was not printing.  &lt;BR /&gt;
&lt;BR /&gt;
Then I remembered that I had read something about a difference between the do while and a do until loop where the while test is evaluated at the top of the loop and the until test is evaluated at the bottom of the loop.&lt;BR /&gt;
&lt;BR /&gt;
So I reversed the:&lt;BR /&gt;
DO _N_ = 1 BY 1 UNTIL(CC EQ '1');  to DO _N_ = 1 BY 1 WHILE(CC NE '1'); &lt;BR /&gt;
and now it is working perfectly.&lt;BR /&gt;
&lt;BR /&gt;
I really appreciate your assistance with this, I wouldn't have had a clue w/o your help.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again.</description>
      <pubDate>Thu, 25 Mar 2010 20:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67569#M19346</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-25T20:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67570#M19347</link>
      <description>I was not thinking clearly.  _N_ should be equal to the number of lines read not one more.  The loop reads the "next" line to see of it has a 1 CC but that does not increment _N_.&lt;BR /&gt;
&lt;BR /&gt;
[pre]if keeperFlag then do _n_ = 1 to _n_;[/pre]&lt;BR /&gt;
Is working in my test program, it should be good for you too.  Sorry to be so dense.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: data _null_;

Message was edited by: data _null_;</description>
      <pubDate>Thu, 25 Mar 2010 22:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67570#M19347</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-03-25T22:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67571#M19348</link>
      <description>I reverted the DO WHILE(CC NE 1) back to the DO UNTIL(CC=1) and changed the &lt;BR /&gt;
&lt;BR /&gt;
IF KEEPERFLAG THEN DO _N_ = 1 TO _N_ - (NOT EOF);&lt;BR /&gt;
&lt;BR /&gt;
to&lt;BR /&gt;
&lt;BR /&gt;
IF KEEPERFLAG THEN DO _N_ = 1 TO _N_;&lt;BR /&gt;
&lt;BR /&gt;
and that worked so they both produced the desired results but your observation explains why it wasn't working the first time.&lt;BR /&gt;
Thanks.</description>
      <pubDate>Fri, 26 Mar 2010 12:28:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67571#M19348</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-26T12:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67572#M19349</link>
      <description>Here is an example that short circuits to the next page when "BOOK A" is not found in the third read of each page.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename FT15F001 temp recfm=F lrecl=161;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
   infile FT15F001 eof=eof end=eof;&lt;BR /&gt;
   array line[50] $161; *array dim should equal report page size;&lt;BR /&gt;
   keeperFlag = 0;&lt;BR /&gt;
   do _n_ = 1 by 1 until(cc eq '1');&lt;BR /&gt;
      input @1 line[_n_] $char161. @@;&lt;BR /&gt;
      if _n_ eq 3 and not index(line[_n_],'BOOK A') then do;&lt;BR /&gt;
         do until(cc eq '1');&lt;BR /&gt;
            input / @1 cc $1. @@;&lt;BR /&gt;
            end;&lt;BR /&gt;
         delete;&lt;BR /&gt;
         end;&lt;BR /&gt;
      input / @1 cc $1. @@;&lt;BR /&gt;
      end;       &lt;BR /&gt;
  eof:&lt;BR /&gt;
   file print noprint ls=161;&lt;BR /&gt;
   do _n_ = 1 to _n_;&lt;BR /&gt;
      put line[_n_] $char161.;&lt;BR /&gt;
      end;&lt;BR /&gt;
   parmcards4;&lt;BR /&gt;
1$$DJDE JDE=STD15,SIDE=(NUFRONT,NOFFSET),END; &lt;BR /&gt;
 JNM: GSGB020 P R I V A T E L A B E L &lt;BR /&gt;
 PGM: GSGB020 BOOK A G R O U P B U Y O R D E R&lt;BR /&gt;
0 &lt;BR /&gt;
 CA&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
0 0001 PRIVATE LABEL MANDARIN ORANGES &lt;BR /&gt;
1$$DJDE JDE=STD15,SIDE=(NUFRONT,NOFFSET),END; &lt;BR /&gt;
 JNM: GSGB020 P R I V A T E L A B E L &lt;BR /&gt;
 PGM: GSGB020 BOOK B G R O U P B U Y O R D E R&lt;BR /&gt;
0 &lt;BR /&gt;
 CA&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
0 0002 PRIVATE LABEL MANDARIN ORANGES &lt;BR /&gt;
1$$DJDE JDE=STD15,SIDE=(NUFRONT,NOFFSET),END; &lt;BR /&gt;
 JNM: GSGB020 P R I V A T E L A B E L &lt;BR /&gt;
 PGM: GSGB020 BOOK A G R O U P B U Y O R D E R&lt;BR /&gt;
0 &lt;BR /&gt;
 CA&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
0 0003 PRIVATE LABEL MANDARIN ORANGES &lt;BR /&gt;
1$$DJDE JDE=STD15,SIDE=(NUFRONT,NOFFSET),END; &lt;BR /&gt;
 JNM: GSGB020 P R I V A T E L A B E L &lt;BR /&gt;
 PGM: GSGB020 BOOK A G R O U P B U Y O R D E R&lt;BR /&gt;
0 &lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
 CA&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
0 0004 PRIVATE LABEL MANDARIN ORANGES &lt;BR /&gt;
0 &lt;BR /&gt;
 CA&lt;BR /&gt;
 ITEM PACK SIZE DESCRIPTION O.I. REBATE CO&lt;BR /&gt;
0 0004 PRIVATE LABEL MANDARIN ORANGES &lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 26 Mar 2010 13:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67572#M19349</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-03-26T13:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67573#M19350</link>
      <description>Just out of curiosity, would this be more efficient or just use less resources since it is "throwing away" the undesirables.&lt;BR /&gt;
&lt;BR /&gt;
I don't think it would make much difference on the current report since it is only a few hundred pages, but if I have to carry this across to a much larger report, it might be of some benefit there.</description>
      <pubDate>Mon, 29 Mar 2010 12:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67573#M19350</guid>
      <dc:creator>HoustonGSC</dc:creator>
      <dc:date>2010-03-29T12:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Printing report pages according to value within report page.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67574#M19351</link>
      <description>It is more efficient, because once it is determined that a page it is not wanted, the program only reads 1 byte from each line sliding down column 1 to the next page,  and more lines are read into the array.  &lt;BR /&gt;
&lt;BR /&gt;
If there are many more discarded pages than good it will make a bigger impact on performance but I may take thousand of pages to see a difference in time.</description>
      <pubDate>Mon, 29 Mar 2010 12:56:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Printing-report-pages-according-to-value-within-report-page/m-p/67574#M19351</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-03-29T12:56:09Z</dc:date>
    </item>
  </channel>
</rss>

