BookmarkSubscribeRSS Feed
DanD999
Quartz | Level 8
I’m just learning ODS and Report Writing Interface. I'm trying to duplicate the attached report. From what I’ve read I don’t think I can use containers because the containers will not go from one page to the next page. You can see from the attached sample report that the report is basically a header/detail. There can be multiple contacts and the text for the note could be long and need to go from one page to the next. I started coding it with just a table with 4 columns – 2 cols for the labels and 2 cols for the data. I’m still working on trying to get rid of the borders on the cells and size the columns. I need to keep the border around the entire form. But I’m wondering if maybe there is a different, better way to go about the report rather than using tables. Will using a template give me the border around the report? Also I need to get rid of the first page that only has the title on it and start the table on the first page. I haven't been able to size the columns. What I try has no effect. Here is the code I have so far. %let destn =&csg_basepath./users/; ods listing close; options nodate nonumber; ods escapechar="^"; options papersize=(7in 7in); ods pdf notoc startpage=no file="&destn./RWITest4.pdf"; title "^{style [ just=center font_size=8pt backgroundcolor=cxccffff font_weight=bold font_face=arial] Summary Report for CCS, DWH and HSR}"; data _null_; set sashelp.class end=eof; if _n_ = 1 then do; dcl odsout adj(); adj.table_start(overrides: "width=7in"); end; adj.row_start(); adj.format_cell(data: "Member Name: ", style_attr: "color=red just=left", height: '1cm'); adj.format_cell(data: name, style_attr: "color=blue just=left ", height: '1cm'); adj.format_cell(data: "Sex: ", style_attr: "color=red just=left ", height: '1cm'); adj.format_cell(data: sex, style_attr: "color=blue just=left ", height: '1cm'); adj.row_end(); adj.row_start(); adj.format_cell(data: "Age: ", style_attr: "color=red just=left "); adj.format_cell(data: age, style_attr: "color=blue just=left "); adj.row_end(); adj.row_start(); adj.format_cell(data: "Height: ", style_attr: "color=red just=left "); adj.format_cell(data: height, style_attr: "color=blue just=left "); adj.row_end(); adj.row_start(); adj.format_cell(data: "Weight: ", style_attr: "color=red just=left "); adj.format_cell(data: weight, style_attr: "color=blue just=left "); adj.row_end(); if eof then do; adj.table_end(); end; run; ods pdf close; Thank you,
3 REPLIES 3
ballardw
Super User

Please try reposting the code using the code format box. The little box at the top of the text entry area that has the SAS "run" icon. It will accept the code as formatted (hopefully) from SAS and maintain indents and such for readability.

DanD999
Quartz | Level 8
I tried posting the text again but wasn't successful. Maybe you can post it for me. I've attached the sas file. I'm on an old browser and haven't been able to get the company to upgrade it yet so that may be the problem. I don't see a 'run' icon. There is a 'Rich text' and 'HTML' link. I tried both of them but when I tried to preview the text, it disappeared. I've changed the text a little since the first post. I'm able to get the cell width smaller but you can see it is not correct. I'm looking to see how to set the column widths in the table_start method to see if that works better. Thanks. P.S. I got an error trying to attach the sas file so now I'm trying a text file.
DanD999
Quartz | Level 8

%let destn		=&csg_basepath./users/;

ods listing close;
options nodate nonumber;
ods escapechar="^";
options papersize=(7in 7in);
ods pdf notoc startpage=no  file="&destn./RWITest4.pdf";
title "^{style [ just=center font_size=6pt backgroundcolor=cxccffff 
			font_weight=bold font_face=arial] Summary Report for CCS, DWH and HSR}";

data _null_;
   set sashelp.class end=eof;

	if _n_ = 1 then do;
		dcl odsout adj();
		   adj.table_start(overrides: "width=7in");
		end;
			adj.row_start();
				adj.format_cell(data: "Member Name: ", overrides: "color=red 
								 just=left width= 1.0in height=3mm font_size=6pt");
				adj.format_cell(data: name, overrides: "color=blue 
								 just=left width= 1.0in height=3mm font_size=6pt");
			   	adj.format_cell(data: "Sex: ", overrides: "color=red 
								 just=left width= 1.0in height=3mm font_size=6pt");
				adj.format_cell(data: sex, overrides: "color=blue 
								 just=left width= 1.0in height=3mm font_size=6pt");
			adj.row_end();
			adj.row_start();
				adj.format_cell(data: "Age: ", style_attr: "color=red just=left ");
				adj.format_cell(data: age, style_attr: "color=blue just=left ");
			adj.row_end();
			adj.row_start();
				adj.format_cell(data: "Height: ", style_attr: "color=red just=left ");
			   	adj.format_cell(data: height, style_attr: "color=blue just=left ");
			adj.row_end();
			adj.row_start();
				adj.format_cell(data: "Weight: ", style_attr: "color=red just=left ");
			   	adj.format_cell(data: weight, style_attr: "color=blue just=left ");
			adj.row_end();
	if eof then do;
	    adj.table_end();
	end;
run;
ods pdf close;
@ballardw wrote:

Please try reposting the code using the code format box. The little box at the top of the text entry area that has the SAS "run" icon. It will accept the code as formatted (hopefully) from SAS and maintain indents and such for readability.


My IE was the issue. It's been upgraded so hopefully the text will be formatted. I can see the run icon now and preview the message.

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
  • 3 replies
  • 1817 views
  • 0 likes
  • 2 in conversation