BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASuserlot
Barite | Level 11

I am creating a table using  particular style according to my requirement. I am having trouble how I can achieve the header that's highlighted in  yellow. I have the sample code with out the header highlighted in yellow. Any suggestions? Thanks.

SASuserlot_0-1605815191704.png

options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase nofmterr nobyline;

data class;
set sashelp.class;
col1= name;
col2= sex;
col3= age;
col4= height;
col5= weight;
run;

ods escapechar = '^';
ods noresults; 
ods listing close; 
ods rtf file = "C:\Users\xx\Desktop\Newfolder\class.rtf"  style = table_rtf; 
proc report data =class ls = 145 ps = 55  missing nowindows split='|'
	         headskip headline    
	         style(report)=[bordertopcolor=black bordertopwidth=2] style(header)=[asis=on just=c vjust=t fontweight=bold 
							font_face= "Times New Roman" background=white borderbottomcolor=black fontsize=9pt];  

	** titles **;
	title1 j = l "class." j = r  'Page ^{thispage} of ^{lastpage}';; 
	title2 j = l "sas";
	title3 j = l "created:&sysdate9 &systime";
	title4 j = c "Table ";
	title5 j = c "SaS class";
	title6 j = c "Practice";
	** report **;
	column  (("First Name ^R/RTF'\brdrb\brdrs\li100\ri100' " col1 col2)("Statistics ^R/RTF'\brdrb\brdrs\li100\ri100' " col3-col5));
									

	define col1		/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Name"			 ;
	define col2 	/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Sex";
	define col3     /group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Age"	;
	define col4 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Height"			;
	define col5 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Weight ";
		
run;
ods rtf close;
ods listing close;
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Opps.

Forget to update the code .

 

options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase nofmterr nobyline;

data class;
set sashelp.class;
col1= name;
col2= sex;
col3= age;
col4= height;
col5= weight;
run;

ods escapechar = '^';
ods noresults; 
ods listing close; 
ods rtf file = "c:\temp\class.rtf"  style = journal ; 
proc report data =class ls = 145 ps = 55  missing nowindows split='|'
	         headskip headline    
	         style(report)=[bordertopcolor=black bordertopwidth=2] style(header)=[asis=on just=c vjust=t fontweight=bold 
							font_face= "Times New Roman" background=white borderbottomcolor=black fontsize=9pt];  

	** titles **;
	title1 j = l "class." j = r  'Page ^{thispage} of ^{lastpage}';; 
	title2 j = l "sas";
	title3 j = l "created:&sysdate9 &systime";
	title4 j = c "Table ";
	title5 j = c "SaS class";
	title6 j = c "Practice";
	** report **;
	column  (("First Name ^R/RTF'\brdrb\brdrs\li100\ri100' " col1 col2)("Statistics ^R/RTF'\brdrb\brdrs\li100\ri100' " col3-col5));
									

	define col1		/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Name"			 ;
	define col2 	/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Sex";
	define col3     /group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Age"	;
	define col4 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Height"			;
	define col5 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Weight ";

compute before/style(lines)={asis=on just=l borderbottomcolor=black borderbottomwidth=2px font_weight=bold};
line '        Personal Information                      Age VS BMS';
endcomp;
	
run;
ods rtf close;
ods listing close;

View solution in original post

10 REPLIES 10
LeonidBatkhan
Lapis Lazuli | Level 10

Hi SASuserlot,

 

I find your table to be confusing (not well designed). I suggest placing Personal Information instead of First Name, and placing Age vs. BMS instead of Statistics. Then you can get rid of that highlighted line altogether. You may replace Name with First Name if needed.

 

Hope this helps.

SASuserlot
Barite | Level 11

Thanks for your suggestion and sorry if it caused any confusion . However I am not focused on the design, I am more focused on  "how I can get a  line  and the highlighted headers" below the "name and sex header, age vs BMS header below the age. height, weight headers . I given the names Personal  information or Age Vs BMS just for sample, it can be any thing for that matter. Is it possible at all!

Ksharp
Super User
options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase nofmterr nobyline;

data class;
set sashelp.class;
col1= name;
col2= sex;
col3= age;
col4= height;
col5= weight;
run;

ods escapechar = '^';
ods noresults; 
ods listing close; 
ods rtf file = "c:\temp\class.rtf"  style = table_rtf; 
proc report data =class ls = 145 ps = 55  missing nowindows split='|'
	         headskip headline    
	         style(report)=[bordertopcolor=black bordertopwidth=2] style(header)=[asis=on just=c vjust=t fontweight=bold 
							font_face= "Times New Roman" background=white borderbottomcolor=black fontsize=9pt];  

	** titles **;
	title1 j = l "class." j = r  'Page ^{thispage} of ^{lastpage}';; 
	title2 j = l "sas";
	title3 j = l "created:&sysdate9 &systime";
	title4 j = c "Table ";
	title5 j = c "SaS class";
	title6 j = c "Practice";
	** report **;
	column  (("First Name ^R/RTF'\brdrb\brdrs\li100\ri100' " col1 col2)("Statistics ^R/RTF'\brdrb\brdrs\li100\ri100' " col3-col5));
									

	define col1		/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Name"			 ;
	define col2 	/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Sex";
	define col3     /group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Age"	;
	define col4 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Height"			;
	define col5 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Weight ";

compute before/style(lines)={asis=on just=l};
line '              xxxxxxxxxxxxx                                yyyyyyyyyyyyyyyyyy';
endcomp;
	
run;
ods rtf close;
ods listing close;
SASuserlot
Barite | Level 11
Thanks for your suggestion. however the output from your code different from my actual requirement. If possible can you please look into initial post image again. Thanks
Kurt_Bremser
Super User

You always have to keep in mind that how a RTF file is rendered is highly dependent on the software used to display it. Even different versions of MS Word will make it look differently.

SASuserlot
Barite | Level 11
Thanks for checking out for me.
Ksharp
Super User

Here is what I got.

 

x.png

Ksharp
Super User

Opps.

Forget to update the code .

 

options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase nofmterr nobyline;

data class;
set sashelp.class;
col1= name;
col2= sex;
col3= age;
col4= height;
col5= weight;
run;

ods escapechar = '^';
ods noresults; 
ods listing close; 
ods rtf file = "c:\temp\class.rtf"  style = journal ; 
proc report data =class ls = 145 ps = 55  missing nowindows split='|'
	         headskip headline    
	         style(report)=[bordertopcolor=black bordertopwidth=2] style(header)=[asis=on just=c vjust=t fontweight=bold 
							font_face= "Times New Roman" background=white borderbottomcolor=black fontsize=9pt];  

	** titles **;
	title1 j = l "class." j = r  'Page ^{thispage} of ^{lastpage}';; 
	title2 j = l "sas";
	title3 j = l "created:&sysdate9 &systime";
	title4 j = c "Table ";
	title5 j = c "SaS class";
	title6 j = c "Practice";
	** report **;
	column  (("First Name ^R/RTF'\brdrb\brdrs\li100\ri100' " col1 col2)("Statistics ^R/RTF'\brdrb\brdrs\li100\ri100' " col3-col5));
									

	define col1		/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Name"			 ;
	define col2 	/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Sex";
	define col3     /group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Age"	;
	define col4 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Height"			;
	define col5 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Weight ";

compute before/style(lines)={asis=on just=l borderbottomcolor=black borderbottomwidth=2px font_weight=bold};
line '        Personal Information                      Age VS BMS';
endcomp;
	
run;
ods rtf close;
ods listing close;
SASuserlot
Barite | Level 11
Thanks. This serves my purpose.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 2563 views
  • 5 likes
  • 4 in conversation