Date: Tue, 9 Sep 2003 08:17:32 -0700
Reply-To: "Huang, Ya" <yhuang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, Ya" <yhuang@AMYLIN.COM>
Subject: Re: BODYTITLE NOT WORKING. (Re: ODS RTF: ... A workaround)
Content-Type: text/plain; charset="iso-8859-1"
Zibao,
What you asked for is doable, but we need another step to get the
'group count' first, so that the next step which assigns the _pgv
can 'look forward' and know where to break the page.
your test data here.
proc sql;
create table test as
select *,count(*) as _grpn
from test
group by item
order by item,level
;
data test;
set test;
by item;
if first.item then _grp+_grpn;
_pgv=ceil(_grp/20);
run;
options nobyline;
proc report data =test nowd;
by _pgv;
column Item Level A ;
define Item /group;
define Level/display;
define A /display;
run;
Kind regards,
Ya
-----Original Message-----
From: Zibao Zhang [mailto:zibaozhang@HOTMAIL.COM]
Sent: Monday, September 08, 2003 6:02 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: BODYTITLE NOT WORKING. (Re: ODS RTF: ... A workaround)
Hi Carey,
The byline is not a problem, "options nobyline" in Ya' code will suppress it. My question is how to control the page break.
data test;
Length Item $20 Level 3 a 3;
do level =1 to 10;
Item ='Var A';
a =int (100*uniform(123)); output;
end;
do level =1 to 6;
Item ='Var B';
a =int (100*uniform(123)); output;
end;
do level =1 to 7;
Item ='Var C';
a =int (100*uniform(123)); output;
end;
run;
data test;
set test;
_pgv=ceil(_n_/20);
run;
options nobyline;
proc report data =test nowd;
by _pgv;
column Item Level A ;
define Item /group;
define Level/display;
define A /display;
run;
The pagebreak is determined only by "_pgv=ceil(_n_/20); " i.e 20 lines in 1 page. Now I hope the pagebreak is determined by max lines(20) in 1 page and the Item value(same value of the Item should be on one page). as shown below, Var C has 7 levels (1-7), but the 7 levels have been splitted into 2 pages. I hope all the 7 levels of Var C will moved into next page. This is my question.
The SAS System 7
08:29 Tuesday, September 9, 2003
Item Level a
Var A 1 75
2 32
3 17
4 90
5 35
6 22
7 78
8 39
9 12
10 18
Var B 1 77
2 43
3 96
4 26
5 71
6 55
Var C 1 53
2 86
3 14
4 86
The SAS System 8
08:29 Tuesday, September 9, 2003
Item Level a
Var C 5 65
6 76
7 70
============
Kind Regards,
Zibao Zhang, MD
----- Original Message -----
From: "Carey Smoak" <carey.smoak@ROCHE.COM>
Newsgroups: bit.listserv.sas-l
To: <SAS-L@LISTSERV.UGA.EDU>
Sent: Tuesday, September 09, 2003 12:32 AM
Subject: Re: BODYTITLE NOT WORKING. (Re: ODS RTF: ... A workaround)
> Hi,
>
> If you have a long report and do not want _pgv=0, _pgv=1, etc to
> appear in the header in Word then you can modify the program as shown
> below:
> 1) add _pgv to the columns statement
> 2) define _pgv as an order variable and use the noprint option
> 3) break after _pgv and use the page option
> 4) remove the 'by' statement for _pgv
>
>
> ods listing close;
> ods rtf file="c:\temp\junk.rtf" style=minimal;
> ods escapechar='^';
>
> data class;
> set sashelp.class
> sashelp.class;
> _pgv=int(_n_/20);
> run;
>
> proc report data=class nowd
> style=[cellpadding = 1pt frame = void rules = groups background =
> white];
> column _pgv name sex age weight;
> define _pgv / order noprint;
> define name /'Name' style=[just=l cellwidth=3in];
> define sex / 'Sex' style=[just=c cellwidth=2in];
> define age / 'Age' style=[just=c cellwidth=1in];
> define weight /'Weight' style=[just=c cellwidth=1in];
> break after _pgv / page;
> compute before _page_;
> line "Use compute before _page_ for titile";
> line "to avoid the bodytitle bug {\line} ^R/RTF'\brdrb\brdrs
> '";
> endcomp;
> compute after _page_ / style=[just=l];
> line "Footer here immediately follow the table";
> line "Second line of footnote here ^R/RTF'\brdrt\brdrs '";
> endcomp;
> run;
>
> ods rtf close;
> ods listing;
>
> Carey G. Smoak
> Roche Molecular Systems, Inc.
>
> zibaozhang@HOTMAIL.COM (Zibao Zhang) wrote in message news:<BAY1-DAV28YQYx3G5aY000004ed@hotmail.com>...
> > Ya, Your workaround is greatly helpful, thanks.
> >
> > But i have another question, for a example like the output shown below (instead of rtf file because SAS-L ingored attached file), Var C is splitted as into two pages. I hope "Var C Level 1-4" flow into the next page in case splitting. I know I should revalue the variable _pgv in the data, But how....
> >
> > Any suggestion is appreciated.
> >
> > ============
> > Kind Regards,
> > Zibao Zhang, MD
> >
> > ---------------------------------------- _pgv=1 -----------------------------------------
> >
> > Item Level a
> > Var A 1 75
> > 2 32
> > 3 17
> > 4 90
> > 5 35
> > 6 22
> > 7 78
> > 8 39
> > 9 12
> > 10 18
> > Var B 1 77
> > 2 43
> > 3 96
> > 4 26
> > 5 71
> > 6 55
> > Var C 1 53
> > 2 86
> > 3 14
> > 4 86
> >
> > ---------------------------------------- _pgv=2 -----------------------------------------
> >
> > Item Level a
> > Var C 5 65
> > 6 76
> > 7 70
> >
> >
> > *This is what i want:
> >
> > ---------------------------------------- _pgv=1 -----------------------------------------
> >
> > Item Level a
> > Var A 1 75
> > 2 32
> > 3 17
> > 4 90
> > 5 35
> > 6 22
> > 7 78
> > 8 39
> > 9 12
> > 10 18
> > Var B 1 77
> > 2 43
> > 3 96
> > 4 26
> > 5 71
> > 6 55
> >
> > ---------------------------------------- _pgv=2 -----------------------------------------
> > Item Level a
> > Var C 1 53
> > 2 86
> > 3 14
> > 4 86
> >
> > 5 65
> > 6 76
> > 7 70
> >
> >
> >
> >
> > ----- Original Message -----
> > From: "Huang, Ya" <yhuang@AMYLIN.COM>
> > Newsgroups: bit.listserv.sas-l
> > To: <SAS-L@LISTSERV.UGA.EDU>
> > Sent: Wednesday, August 13, 2003 12:06 AM
> > Subject: Re: BODYTITLE NOT WORKING. (Re: ODS RTF: ... A workaround)
> >
> >
> > > Here is my current workaround:
> > >
> > > 1. I don't use title & footnote because I want them to be in the
> > > body part, also because I have to leave the real header/footer
> > > section untouched for global header/footer when multiple rtf
> > > files(tables/listings) are eventually combined together in word.
> > > 2. I don't use bodytitle option because it has bug.
> > > 3. I have to create a pagebreak var as a 'BY' var, so that I can use
> > > 'BY' statement which will insert a pagebreak for me after each page.
> > >
> > > Now the sample code:
> > >
> > > options nodate nonumber nobyline papersize=letter orientation=landscape;
> > > title;
> > > footnote;
> > >
> > > ods listing close;
> > > ods rtf file="c:\temp\junk.rtf" style=minimal;
> > > ods escapechar='^';
> > >
> > > data class;
> > > set sashelp.class
> > > sashelp.class;
> > > _pgv=int(_n_/20);
> > > run;
> > >
> > > proc report data=class nowd
> > > style=[cellpadding = 1pt frame = void rules = groups background = white];
> > >
> > > column name sex age weight;
> > > define name /'Name' style=[just=l cellwidth=3in];
> > > define sex / 'Sex' style=[just=c cellwidth=2in];
> > > define age / 'Age' style=[just=c cellwidth=1in];
> > > define weight /'Weight' style=[just=c cellwidth=1in];
> > > compute before _page_;
> > > line "Use compute before _page_ for titile";
> > > line "to avoid the bodytitle bug {\line} ^R/RTF'\brdrb\brdrs '";
> > > endcomp;
> > > compute after _page_ / style=[just=l];
> > > line "Footer here immediately follow the table";
> > > line "Second line of footnote here ^R/RTF'\brdrt\brdrs '";
> > > endcomp;
> > > by _pgv;
> > > run;
> > > ods rtf close;
> > > ods listing;
> > >
> > >
> > > There is another bug: when use compute after _page_ for footnote,
> > > cellwidth for each column might be messed up, I have to do "workaround
> > > for workaround" because of this :-)
> > >
> > > Ya
> > >
>
|