I realise the pagination when using ODS RTF cannot be controlled within PROC REPORT as well as it is when generating a TXT file. So my goal is to address it either before the PROC REPORT or forcing it in the PROC REPORT.
So far I've already taken care of the pagination by deriving a variable that stores, for each observation, which page it's expected to appear on. Using the following statement in the PROC REPORT: "BREAK AFTER &pgno_var. / PAGE;", I can control when page breaks are inserted, so that has taken care of the "vertical" pagination.
So now I only need to address the horizontal one. I do realise that my derived page numbers are going to be off when I've got more columns than what can fit on a page, but if I can control the layout, I think I'd be willing to give up the accuracy of the page numbering.
Now I've been searching on PROC TEMPLATE and it seems the only way to retrieve the values for the style is to send the whole template to a file:
proc template;
source pharma/file='pharma.txt';
run;
and then read the file and search for the "leftmargin" & "rightmargin"...
Is there a way to send these directly to a dataset w/o having to generate a file?
If I know the width of page, which is determined by the dimension of the paper used (letter, A4...) minus the margins, then I'll know what width is available for the display of the columns. I know the "item" column width and the "group" column width, since these are macro parameters. I know the total number of groups to be reported as well, it's also a macro parameter. So I think I should be able to estimate how many groups can fit on a page. Then in my "%DO" loop for the "group" colums, I can add a "%IF" to insert the "PAGE" option when a mulitple of the "magic" number is dealt with.