From: Roger DeAngelis on
On Aug 11, 11:04 am, Roger DeAngelis <rogerjdeange...(a)gmail.com>
wrote:
> On Aug 10, 7:27 pm, Roger DeAngelis <rogerjdeange...(a)gmail.com> wrote:
>
>
>
>
>
> > On Aug 10, 3:39 pm, Roger DeAngelis <rogerjdeange...(a)gmail.com> wrote:
>
> > Some comments
>
> >  It shouldn't matter if you use the default listing output or rtf.  I
> > used ps=22 and no ods just to test. I also included the macro variable
> > maxpge incase you want to run proc report for each page. ie %do page=1
> > %to &maxpge; proc report ... %end;
>
> > You don't need the compute block in the second 'proc report' and both
> > reports should have the same 'ods rtf' conditions. You should be able
> > to send the first 'ods rtf' to the bit bucket.
>
> > I
>
> > > Hi,
>
> > >   I think there are two possible solutions. One allows different
> > > footnotes and titles on each page and the other does not.  Here is the
> > > simpler solution.
> > > Basically run proc report twice, once to get the page numbers and a
> > > second time to use the page numbers.
>
> > > options
> > > ps=22;run;
> > > proc report data=test nowd
> > > out=pge;
> > >   column pge trt i
> > > x;
> > > define pge /
> > > computed;
> > > define trt  /display id group order=internal 'Treatment'
> > > format=trt. ;
> > > define i / display
> > > 'Number';
> > > define x / display
> > > 'Class';
> > > break after trt /
> > > page;
> > > compute before
> > > _page_;
> > >   pag
> > > +1;
>
> > > pge=pag;
> > > endcompute;
> > > run;quit;
>
> > > /* retain page - cleanup report output
> > > */
> > > data addpge(drop=pge where=(_break_ ne
> > > '_PAGE_'));
> > >   retain
> > > page;
> > >   set pge
> > > end=dne;
> > >   if pge ne . then
> > > page=pge;
> > >   if dne then call symputx('pgemax',put(page,
> > > 3.));
> > > run;
>
> > > proc report data=addpge
> > > nowd;
> > >   column page trt i
> > > x;
> > > define page / order
> > > noprint;
> > > define trt  /order id group order=internal 'Treatment'
> > > format=trt. ;
> > > define i / display
> > > 'Number';
> > > define x / display
> > > 'Class';
> > > break after trt /
> > > page;
> > > compute before
> > > _page_;
> > >   pag
> > > +1;
>
> > > pge=pag;
> > > endcompute;
> > > run;quit;
>
> > > /* sample page */
>
> > >            Treatment     Number      Class
> > > XXXXXX - Combined           901        913
> > >                             902        914
> > >                             903        915
> > >                             904        916
> > >                             905        917
> > >                             906        918
> > >                             907        919
> > >                             908        920
> > >                             909        921
> > >                             910        922
> > >                             911        923
> > >                             912        924
> > >                             913        925
> > >                             914        926
> > >                             915        927
> > >                             916        928
> > >                             917        929
> > >                             918        930
> > >                             919        931
> > >                             920        932
> > >                             921        933
>
> > > The more complicated method is to run the second proc report for each
> > > page. This allows much more flexibility with what you can put on each
> > > page.
>
> > > On Aug 9, 4:36 pm, Ya <huang8...(a)gmail.com> wrote:
>
> > > > On Aug 8, 2:18 pm, HI <ranis...(a)gmail.com> wrote:
>
> > > > > Hi,
> > > > > I am new to ods rtf.
> > > > > Can anyone help me to get the group variable to be printed in all the
> > > > > pages.
> > > > > i am including a small program to make my question more sensible.
>
> > > > > I need the Treatment name to be printed in all the pages.Please help
> > > > > me.
>
> > > > > data test;
> > > > >   do i=1 to 1500;
> > > > >   x=i+12;
> > > > >   if i le 500 then trt=1;
> > > > >   else if 501 lt i le 1000 then trt=2;
> > > > >   else trt=3;
> > > > >   output;
> > > > >   end;
> > > > > run;
>
> > > > > proc format;
> > > > >    value trt
> > > > >          1='XXXXXX - Monotherapy'
> > > > >          2='XXXXXX - Combined'
> > > > >          3='Total';
> > > > > quit;
>
> > > > > ods rtf file='de.rtf';
> > > > > proc report data=test nowd ;
> > > > >   column  trt i x;
> > > > > define trt  /id group order=internal 'Treatment' format=trt.. ;
> > > > > define i / display 'Number';
> > > > > define x / display 'Class';
> > > > > break after trt / page;
> > > > > run;
> > > > > ods rtf close;
>
> > > > > Thanks
>
> > > > How about this?
>
> > > > data test;
> > > >   do i=1 to 150;
> > > >   x=i+12;
> > > >   if i le 50 then trt=1;
> > > >   else if 51 lt i le 100 then trt=2;
> > > >   else trt=3;
> > > >   output;
> > > >   end;
> > > > run;
>
> > > > data test;
> > > >  set test;
> > > > pg=ceil(_n_/30);
> > > > run;
>
> > > > proc format;
> > > >    value trt
> > > >          1='XXXXXX - Monotherapy'
> > > >          2='XXXXXX - Combined'
> > > >          3='Total';
> > > > quit;
>
> > > > ods rtf file='c:\temp\de.rtf';
> > > > proc report data=test nowd ;
> > > >   column pg trt i x;
> > > > define pg / noprint order;
> > > > define trt  /id order order=internal 'Treatment' format=trt. ;
> > > > define i / display 'Number';
> > > > define x / display 'Class';
> > > > break after pg / page;
> > > > run;
> > > > ods rtf close;
>
> > > > Basically, we add a page var and set the page size to be 30.
> > > > The problem of this method is that when some columns have too many
> > > > characters and
> > > > causes the line to wrap inside a cell, the pagingantion may not work
> > > > properly.
>
> > > > So far, I haven't see any perfect solution to deal with rtf pagination
> > > > issue, even with tagsets.rtf.
>
> > > > HTH
>
> > > > ya- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
>
> Hi Ya,
>
>   I was surprised that the pagination in the output dataset from proc
> report does not seem to agree with the rtf output pagination. This
> seems like a bug. It seems that Art's response may be the best.
> However, If you set ps to a number that would work for RTF and LISTING
> output then you should be ok. I got the following to work.
>
> data
> TrePgeTrt;
>   do
> Trt='APC','PBO';
>    do Lyn=1 to
> 70;
>
> output;
>
> end;
>
> end;
> run;
>
> options orientation=portrait ps=22;    /* ps= seems to be the key -
> need to sync rtf and listing
> */
> proc report data=TrePgeTrt nowd out=PgeBadRpt
> missing;
> column Pge Trt
> Lyn;
> define Pge /
> computed;
> define Trt / group
> order=data;
> define Lyn /
> order;
> break after Trt /
> page;
> compute before
> _page_;
>   Pag
> +1;
>
> Pge=Pag;
> endcompute;
> run;quit;
>
> /* retain page - cleanup report output
> */
> data FixPge(drop=pge where=(_break_ not in ( '_PAGE_',
> 'Trt')));
>   length pgetrt
> $6;
>   retain
> pgetrt;
>   set PgeBadRpt
> end=dne;
>   if pge ne . then
> pgetrt=cats(trt,put(pge,z3.));
> run;
>
> ods rtf file="c:\lil
> \TreGudRpt.rtf";
> proc report data=FixPge nowd
> missing;
> column PgeTrt Trt
> Lyn;
> define PgeTrt / group
> noprint;
> define Trt /
> group;
> define Lyn  /
> order;
> break after PgeTrt  /
> page;
> run;quit;
> ods rtf
> close;- Hide quoted text -
>
> - Show quoted text -

One more point, I tried using the rtf destination for both proc
reports and that did not work either.

From: Roger DeAngelis on
On Aug 11, 11:13 am, Roger DeAngelis <rogerjdeange...(a)gmail.com>
wrote:
> On Aug 11, 11:04 am, Roger DeAngelis <rogerjdeange...(a)gmail.com>
> wrote:
>
>
>
>
>
> > On Aug 10, 7:27 pm, Roger DeAngelis <rogerjdeange...(a)gmail.com> wrote:
>
> > > On Aug 10, 3:39 pm, Roger DeAngelis <rogerjdeange...(a)gmail.com> wrote:
>
> > > Some comments
>
> > >  It shouldn't matter if you use the default listing output or rtf.  I
> > > used ps=22 and no ods just to test. I also included the macro variable
> > > maxpge incase you want to run proc report for each page. ie %do page=1
> > > %to &maxpge; proc report ... %end;
>
> > > You don't need the compute block in the second 'proc report' and both
> > > reports should have the same 'ods rtf' conditions. You should be able
> > > to send the first 'ods rtf' to the bit bucket.
>
> > > I
>
> > > > Hi,
>
> > > >   I think there are two possible solutions. One allows different
> > > > footnotes and titles on each page and the other does not.  Here is the
> > > > simpler solution.
> > > > Basically run proc report twice, once to get the page numbers and a
> > > > second time to use the page numbers.
>
> > > > options
> > > > ps=22;run;
> > > > proc report data=test nowd
> > > > out=pge;
> > > >   column pge trt i
> > > > x;
> > > > define pge /
> > > > computed;
> > > > define trt  /display id group order=internal 'Treatment'
> > > > format=trt. ;
> > > > define i / display
> > > > 'Number';
> > > > define x / display
> > > > 'Class';
> > > > break after trt /
> > > > page;
> > > > compute before
> > > > _page_;
> > > >   pag
> > > > +1;
>
> > > > pge=pag;
> > > > endcompute;
> > > > run;quit;
>
> > > > /* retain page - cleanup report output
> > > > */
> > > > data addpge(drop=pge where=(_break_ ne
> > > > '_PAGE_'));
> > > >   retain
> > > > page;
> > > >   set pge
> > > > end=dne;
> > > >   if pge ne . then
> > > > page=pge;
> > > >   if dne then call symputx('pgemax',put(page,
> > > > 3.));
> > > > run;
>
> > > > proc report data=addpge
> > > > nowd;
> > > >   column page trt i
> > > > x;
> > > > define page / order
> > > > noprint;
> > > > define trt  /order id group order=internal 'Treatment'
> > > > format=trt. ;
> > > > define i / display
> > > > 'Number';
> > > > define x / display
> > > > 'Class';
> > > > break after trt /
> > > > page;
> > > > compute before
> > > > _page_;
> > > >   pag
> > > > +1;
>
> > > > pge=pag;
> > > > endcompute;
> > > > run;quit;
>
> > > > /* sample page */
>
> > > >            Treatment     Number      Class
> > > > XXXXXX - Combined           901        913
> > > >                             902        914
> > > >                             903        915
> > > >                             904        916
> > > >                             905        917
> > > >                             906        918
> > > >                             907        919
> > > >                             908        920
> > > >                             909        921
> > > >                             910        922
> > > >                             911        923
> > > >                             912        924
> > > >                             913        925
> > > >                             914        926
> > > >                             915        927
> > > >                             916        928
> > > >                             917        929
> > > >                             918        930
> > > >                             919        931
> > > >                             920        932
> > > >                             921        933
>
> > > > The more complicated method is to run the second proc report for each
> > > > page. This allows much more flexibility with what you can put on each
> > > > page.
>
> > > > On Aug 9, 4:36 pm, Ya <huang8...(a)gmail.com> wrote:
>
> > > > > On Aug 8, 2:18 pm, HI <ranis...(a)gmail.com> wrote:
>
> > > > > > Hi,
> > > > > > I am new to ods rtf.
> > > > > > Can anyone help me to get the group variable to be printed in all the
> > > > > > pages.
> > > > > > i am including a small program to make my question more sensible.
>
> > > > > > I need the Treatment name to be printed in all the pages.Please help
> > > > > > me.
>
> > > > > > data test;
> > > > > >   do i=1 to 1500;
> > > > > >   x=i+12;
> > > > > >   if i le 500 then trt=1;
> > > > > >   else if 501 lt i le 1000 then trt=2;
> > > > > >   else trt=3;
> > > > > >   output;
> > > > > >   end;
> > > > > > run;
>
> > > > > > proc format;
> > > > > >    value trt
> > > > > >          1='XXXXXX - Monotherapy'
> > > > > >          2='XXXXXX - Combined'
> > > > > >          3='Total';
> > > > > > quit;
>
> > > > > > ods rtf file='de.rtf';
> > > > > > proc report data=test nowd ;
> > > > > >   column  trt i x;
> > > > > > define trt  /id group order=internal 'Treatment' format=trt. ;
> > > > > > define i / display 'Number';
> > > > > > define x / display 'Class';
> > > > > > break after trt / page;
> > > > > > run;
> > > > > > ods rtf close;
>
> > > > > > Thanks
>
> > > > > How about this?
>
> > > > > data test;
> > > > >   do i=1 to 150;
> > > > >   x=i+12;
> > > > >   if i le 50 then trt=1;
> > > > >   else if 51 lt i le 100 then trt=2;
> > > > >   else trt=3;
> > > > >   output;
> > > > >   end;
> > > > > run;
>
> > > > > data test;
> > > > >  set test;
> > > > > pg=ceil(_n_/30);
> > > > > run;
>
> > > > > proc format;
> > > > >    value trt
> > > > >          1='XXXXXX - Monotherapy'
> > > > >          2='XXXXXX - Combined'
> > > > >          3='Total';
> > > > > quit;
>
> > > > > ods rtf file='c:\temp\de.rtf';
> > > > > proc report data=test nowd ;
> > > > >   column pg trt i x;
> > > > > define pg / noprint order;
> > > > > define trt  /id order order=internal 'Treatment' format=trt.. ;
> > > > > define i / display 'Number';
> > > > > define x / display 'Class';
> > > > > break after pg / page;
> > > > > run;
> > > > > ods rtf close;
>
> > > > > Basically, we add a page var and set the page size to be 30.
> > > > > The problem of this method is that when some columns have too many
> > > > > characters and
> > > > > causes the line to wrap inside a cell, the pagingantion may not work
> > > > > properly.
>
> > > > > So far, I haven't see any perfect solution to deal with rtf pagination
> > > > > issue, even with tagsets.rtf.
>
> > > > > HTH
>
> > > > > ya- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -
>
> > Hi Ya,
>
> >   I was surprised that the pagination in the output dataset from proc
> > report does not seem to agree with the rtf output pagination. This
> > seems like a bug. It seems that Art's response may be the best.
> > However, If you set ps to a number that would work for RTF and LISTING
> > output then you should be ok. I got the following to work.
>
> > data
> > TrePgeTrt;
> >   do
> > Trt='APC','PBO';
> >    do Lyn=1 to
> > 70;
>
> > output;
>
> > end;
>
> > end;
> > run;
>
> > options orientation=portrait ps=22;    /* ps= seems to be the key -
> > need to sync rtf and listing
> > */
> > proc report data=TrePgeTrt nowd out=PgeBadRpt
> > missing;
> > column Pge Trt
> > Lyn;
> > define Pge /
> > computed;
> > define Trt / group
> > order=data;
> > define Lyn /
> > order;
> > break after Trt /
> > page;
> > compute before
> > _page_;
> >   Pag
> > +1;
>
> > Pge=Pag;
> > endcompute;
> > run;quit;
>
> > /* retain page - cleanup report output
> > */
> > data FixPge(drop=pge where=(_break_ not in ( '_PAGE_',
> > 'Trt')));
> >   length pgetrt
> > $6;
> >   retain
> > pgetrt;
> >   set PgeBadRpt
> > end=dne;
> >   if pge ne . then
> > pgetrt=cats(trt,put(pge,z3.));
> > run;
>
> > ods rtf file="c:\lil
> > \TreGudRpt.rtf";
> > proc report data=FixPge nowd
> > missing;
> > column PgeTrt Trt
> > Lyn;
> > define PgeTrt / group
> > noprint;
> > define Trt /
> > group;
> > define Lyn  /
> > order;
> > break after PgeTrt  /
> > page;
> > run;quit;
> > ods rtf
> > close;- Hide quoted text -
>
> > - Show quoted text -
>
> One more point, I tried using the rtf destination for both proc
> reports and that did not work either.- Hide quoted text -
>
> - Show quoted text -

One more point, I turned listing off for the first proc report and
used only the rtf destination. Interestingly it came up with a
different pagination but still did not match the RTF file.