The SAS Output Delivery System and reporting techniques

span header proc report

Reply
Occasional Contributor
Posts: 19

span header proc report

Hello,

I am using the proc report , and would like displaying 1 or 2 , 3 …or  several levels of spans headers

I would like that the lines of each span header to be separated for the different modalities with a black space

I can do that if I have one level of span header  , but not beyond of one level  => this is my issue

 The two programs bellow illustrate the issue

 

One span header :

Here the line of the span header is separated by blank space for each modalities ( header11 header12 header13 )

 


data class;
	set sashelp.class;
	attrib _empty length=$1;
	_empty='';
run;

ods rtf;
ods escapechar='^';
GOPTIONS DEVICE=SASPRTC;

proc report data=class headline headskip split="$" missing 
	style(header)= [background=white borderbottomcolor=black borderbottomwidth=0.1pt just=center vjust=top] contents=""
	style(report)=[ frame=hsides
	rules=group
	cellpadding=1pt
	cellspacing=.15pt
	borderwidth=.15pt];
	column 
		('header11' age Height) 
		('^S={borderbottomcolor=white borderbottomwidth=2}' _empty)
		('header12' Name Sex) 
		('^S={borderbottomcolor=white borderbottomwidth=2}' _empty)
		('header21' Weight );
	define _empty/' ' style(column)={cellwidth=10 };
	define age / order=data style(column)=[cellwidth=1.5 in just=Left];
	define Height / order=data style(column)=[cellwidth=1.5 in just=Left];
	define Name / order=data style(column)=[cellwidth=1.5 in just=center];
	define Sex / order=data style(column)=[cellwidth=1.5 in just=center];
	define Weight / order=data style(column)=[cellwidth=1.5 in just=Left];
run;

ods rtf close;

One_span_header_level.JPG

 

Tow span header

Here the line of the span header is separated by blank space for each modalities  ( header11 header12 header21 )

But not for the second level modalities ( header11 header12 header21 )  

 

data class;
	set sashelp.class;
	attrib _empty length=$1;
	_empty='';
run;

ods rtf;
ods escapechar='^';
GOPTIONS DEVICE=SASPRTC;

proc report data=class headline headskip split="$" missing 
	style(header)= [background=white borderbottomcolor=black borderbottomwidth=0.1pt just=center vjust=top] contents=""
	style(report)=[ frame=hsides
	rules=group
	cellpadding=1pt
	cellspacing=.15pt
	borderwidth=.15pt];
	column 
		('header1'
			('header11' age Height) 
				('^S={borderbottomcolor=white borderbottomwidth=2}' _empty)
			('header12' Name Sex) 
				('^S={borderbottomcolor=white borderbottomwidth=2}' _empty)
		)
			('^S={borderbottomcolor=white borderbottomwidth=2}' _empty)
		('header2' 
			('header21' Weight )

		)
		
			;
	define _empty/' ' style(column)={cellwidth=10 };
	define age / order=data style(column)=[cellwidth=1.5 in just=Left];
	define Height / order=data style(column)=[cellwidth=1.5 in just=Left];
	define Name / order=data style(column)=[cellwidth=1.5 in just=center];
	define Sex / order=data style(column)=[cellwidth=1.5 in just=center];
	define Weight / order=data style(column)=[cellwidth=1.5 in just=Left];
run;

ods rtf close;

Tow_span_header_level.JPG

thak you for your help 

 

best regard 

 

 

Contributor
Posts: 20

Re: span header proc report

Hi

 

Check this. I made little change in your code and replaced RTF Tags

data class;
	set sashelp.class;
	attrib _empty length=$1;
	_empty='';
run;

ods rtf;
ods escapechar='^';
GOPTIONS DEVICE=SASPRTC;

proc report data=class headline headskip split="$" missing nowd ps=54
	style(header)= [background=white protectspecialchars = off just=center vjust=top] contents=""
	style(report)=[ frame=hsides
	rules=group
	cellpadding=1pt
	cellspacing=.15pt
	borderwidth=.15pt];
	column 
		('\brdrb\brdrs header1'
			('\brdrb\brdrs header11' age Height) 
				_empty
			('\brdrb\brdrs header12' Name Sex) 
		)
        _empty
		('\brdrb\brdrs header2' 
			('\brdrb\brdrs header21' Weight )

		)
		
			;
	define _empty/' ' style(column)={cellwidth=10 };
	define age / order=data style(column)=[cellwidth=1.5 in just=Left];
	define Height / order=data style(column)=[cellwidth=1.5 in just=Left];
	define Name / order=data style(column)=[cellwidth=1.5 in just=center];
	define Sex / order=data style(column)=[cellwidth=1.5 in just=center];
	define Weight / order=data style(column)=[cellwidth=1.5 in just=Left];
run;

ods rtf close;
Ask a Question
Discussion stats
  • 1 reply
  • 431 views
  • 0 likes
  • 2 in conversation