- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
We are trying to conditionally add blank rows so our bookmarks line up. Which after doing that they do, but on new pages we have 2 blank rows. We were hoping to find a way to know if it's a new page and not put the 2 blank rows. In the example below we would put this check after the obj.body_start().
Here is an example of our code:
obj.table_start(Label:Templabel, overrides: 'frame=void rules=none cellpadding=0in cellspacing=.06in ') ; obj.body_start() ; obj.row_start() ; obj.format_cell(text: " ", column_span: 2, overrides: "backgroundcolor=white just=left fontweight=bold font_face='Courier New' font_size=9pt ") ; obj.row_end() ; obj.row_start() ; obj.format_cell(text: " ", column_span: 2, overrides: "backgroundcolor=white just=left fontweight=bold font_face='Courier New' font_size=9pt ") ; obj.row_end() ;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
Here's the challenge with both the scenarios you show. The [NEW PAGE] indicator that you show is impacted by margins, fonts, title and footnote. So if you created the report at 6pt, the [NEW PAGE] would happen at a different location in one run than it would happen in a subsequent run if you changed the font size for the report to 20pt. In the "old days" of writing output with DATA _NULL_ and PUT statement, you could toggle a "LINESLEFT" variable on, but that was based on PAGESIZE and the assumption of a fixed pitch monospace font (as shown here: https://support.sas.com/kb/24/700.html ). So LINESLEFT won't help you with what you want because the concept of "lines" on a page doesn't apply to proportionally spaced fonts.
But, that was long before the new Report Writing Interface days and the object and method syntax for generating custom tables. According to the tip sheet: https://support.sas.com/rnd/base/ods/Tipsheet_RWI.pdf there is obj.page syntax that allows you to force a page break, but I do not believe there's any kind of automatic variable you can test to determine when the page break is going to occur when/if a table breaks across pages.
You might want to check with Tech Support with your full code and some test data. But otherwise, I don't have any ideas.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
Without seeing more of the code and having some test data, it is nearly impossible to make any constructive suggestions. I am having a hard time visualizing how the bookmarks on the side will line up with the table inside the document, especially when scrolling through the pages on a multi-page document. If you can't post data and code here in the Forum, then you may want to open a track with Tech Support for help.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply.
What I really want to know is if there is an indicator to check within my code if it is a new page.
That code was an example of how the ods table is created. I was hoping to add an if statement before the 2 blank rows to add them or not based on if the page is new.
I have opened a ticket in the past for an issue with how the bookmark doesn't line up correctly and I was told that it was an issue, but no work around so I'm trying to do it a different way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I still think that Tech Support is your best bet. I just can't visualize how anything is going to line up in the bookmark area as you describe.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What is your papersize setting when the file is created? What is the maximum font size in each line of the table? How much guard space is around the text values output? How much space is used by header/footer on the "page" if any? Any Title or Footnote statments and their font size; current style Parskip option size.
Those are just some of the questions you would have to be able to answer to begin to calculate how much of a "page" is used. Tables that break across pages may also behave a bit differently.
Many many years ago, 1980's vintage, I worked for an organization that used SAS to write printer markup text for a specific printer for our major annual report document. Every year we had to proof-read everything for just the tables to align properly. If we had a new value that hadn't appeared before we had to recalculate cell boundaries because one value used 0.05in more text than last year. What you are doing is akin to that level of detail.
If I were assigned this task by a manager I would ask him how much money in terms of man-hours he was willing to fund to do something that may not add much to the document usability. The project I had worked with was moderately mature and had gone through 6 or 7 iterations so we did not have to modify a lot of stuff. But one cell with one name in it cost us about 10 man-hours to address all the related issues.
If had not had the people that wrote the original code the man-hour cost could well have gone up an order of magnitude just figuring out where the changes needed to be made. Maintenance of such a low-level approach needs to be considered.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't think I'm explaining what I'm looking for correctly or I'm not understanding how hard it is to get this indication.
Does the SAS system itself have an indicator of when the text for an ods pdf file is going on a new page or is that the calculation that @ballardw mentioned?
In example #1 the information can span multiple pages and that is fine.
In example #2 a new variable is starting on the new page and that is when I need to know that this scenario is happening.
Example #1 Var1 This is test variable 1 Var2 This is test variable 2 Var3 This is test variable 3. This is test variable 3. This is test variable 3. This is test variable 3. This is test variable 3. This is test variable 3. [NEW PAGE] This is test variable 3. This is test variable 3. This is test variable 3. This is test variable 3. Example #2 Var1 This is test variable 1 Var2 This is test variable 2 Var3 This is test variable 3. [NEW PAGE] Var4 This is test variable 4 Var5 This is test variable 5
Thank you @Cynthia_sas and @ballardw for your help and pointing out that this may be much bigger of an issue then I initially thought.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
Here's the challenge with both the scenarios you show. The [NEW PAGE] indicator that you show is impacted by margins, fonts, title and footnote. So if you created the report at 6pt, the [NEW PAGE] would happen at a different location in one run than it would happen in a subsequent run if you changed the font size for the report to 20pt. In the "old days" of writing output with DATA _NULL_ and PUT statement, you could toggle a "LINESLEFT" variable on, but that was based on PAGESIZE and the assumption of a fixed pitch monospace font (as shown here: https://support.sas.com/kb/24/700.html ). So LINESLEFT won't help you with what you want because the concept of "lines" on a page doesn't apply to proportionally spaced fonts.
But, that was long before the new Report Writing Interface days and the object and method syntax for generating custom tables. According to the tip sheet: https://support.sas.com/rnd/base/ods/Tipsheet_RWI.pdf there is obj.page syntax that allows you to force a page break, but I do not believe there's any kind of automatic variable you can test to determine when the page break is going to occur when/if a table breaks across pages.
You might want to check with Tech Support with your full code and some test data. But otherwise, I don't have any ideas.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Cynthia,
That is what I didn't understand and now I do. I'm going to reach out to tech support and see if they can help me figure it out with the process I'm using.