Date: Fri, 25 Feb 2011 10:48:19 -0600
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: By statement in Proc Report
In-Reply-To: <AANLkTikNRgRb6hj+ix5RemYjhnPTYguwW+5n8Sz+PaR4@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
You can do it with BY but you have to pre-process. Or use COMPLETEROWS as....
proc report data=sashelp.class list nowd completerows;
columns sex age n;
define sex / group noprint;
define age/group;
break before sex / page;
compute before _page_;
line 'Sex=' sex $8.;
endcomp;
run;
On Fri, Feb 25, 2011 at 9:14 AM, Charlie Huang
<charlie.chao.huang@gmail.com> wrote:
> Hi,
>
> In Proc Format, if I use by statement, I will have such results:
>
> proc sort data=sashelp.class out=one;
> by sex;
> run;
>
> proc report data=one nowd;
> by sex;
> columns age n;
> define age/group;
> run;
>
>
> -- Sex=F -----------
>
> Age n
> 11 1
> 12 2
> 13 2
> 14 2
> 15 2
>
>
> -- Sex=M -----------
>
> Age n
> 11 1
> 12 3
> 13 1
> 14 2
> 15 2
> 16 1
>
> If I want to have a uniformized table format for both gender and my
> desired result is like below, any way in Proc Report can do it? Many
> thanks.
>
> -- Sex=F -----------
>
> Age n
> 11 1
> 12 2
> 13 2
> 14 2
> 15 2
> 16 0
>
>
> -- Sex=M -----------
>
> Age n
> 11 1
> 12 3
> 13 1
> 14 2
> 15 2
> 16 1
>
|