The SAS Output Delivery System and reporting techniques

Looking for better way for this report

Reply
Contributor
Posts: 43

Looking for better way for this report

Hi,
Take sashelp.class as example, how can I create a report as follows:

Sex: F
Name Height
Alice 56.5
Barbara 65.3
Carol 62.8
Jane 59.8
Janet 62.5
Joyce 51.3
Judy 64.3
Louise 56.3
Mary 66.5

Sex: M
Name Height
Alfred 69
Henry 63.5
James 57.3
Jeffrey 62.5
John 59
Philip 72
Robert 64.8
Ronald 67
Thomas 57.5
William 66.5

For now, I always do it using TITLE statement with #BYVAL. I am wondering if there exist a smarter method.

Any idea will be appreciated.
N/A
Posts: 0

Re: Looking for better way for this report

Hi Kevin,

You can try this:

proc sort data=sashelp.class out=class;
by sex;
run;

data class;
set class class class class class class class class class class class class;
run;

proc report data=class nowindows;
column sex name height;

define sex /order noprint;

break after sex/page;

compute before _page_/left;
line "Sex: " sex $8.;
endcomp;
run;
Respected Advisor
Posts: 3,777

Re: Looking for better way for this report

Smarter? I don't know. Different, sort of.

I just realized this is the same as the post by John JW sorry 'bout 'dat.

[pre]
ods rft file='class02.rtf';
ods rtf startpage=never;
proc report nowd list data=sashelp.class;
column sex name age height weight;
define _all_ / display;
define sex / order noprint;
break before sex / page;
compute before _page_;
line 'Sex:' sex $1.;
endcomp;
run;
ods rtf close;
[/pre] Pay attentention.


Message was edited by: data _null_;
Contributor
Posts: 43

Re: Looking for better way for this report

Thank you.
It is excat what I want. Smiley Happy
Ask a Question
Discussion stats
  • 3 replies
  • 101 views
  • 0 likes
  • 3 in conversation