BookmarkSubscribeRSS Feed
SASdevAnneMarie
Barite | Level 11

Hello experts,

I can’t understand why the line and table don’t have the same width (the document is attached).

 

My papersiez iz A: 8.3 x 11.7 inch

So, I chosen OPTIONS TOPMARGIN=0.5 in BOTTOMMARGIN=0.5 in LEFTMARGIN=0.5 in RIGHTMARGIN=0.5 in;

 

In obj.region(width: "7.3 in"), I chosen 7.3 (8.3-(0.5+0.5))=7.3

In I have also 7.3: "table1",label: "Notre Première Table", overrides: "width=7.3

 

My code is:

OPTION NODATE NONUMBER;
OPTIONS PAPERSIZE=A4;
OPTIONS TOPMARGIN=0.5 in BOTTOMMARGIN=0.5 in LEFTMARGIN=0.5 in RIGHTMARGIN=0.5 in;
ODS NORESULTS;
ODS PDF FILE = "\\XXXXXX\TEST.pdf" dpi=1800;


data _NULL_;
set RESULTAT_PRFL_FINAL_PP_XL2(obs=1);
declare odsout obj();
obj.layout_absolute(columns:1 );
obj.line(style_attr:
"bordercolor=green", size:'0.8mm');
obj.region(width:
"3.5 in",x:"3.5 in",height:"1.2 in",y:"0.2 in" ,style_attr: "bordercolor=cx338AFF");
obj.format_text( data: "Information",
overrides: " just=left color=green font_weight=bold font_size=24pt ");
obj.region(width:
"7.3 in" ,height:"8 in",y:"1.4 in", style_attr: "");
obj.line(style_attr:
"bordercolor=green ", size:'0.8mm');
obj.table_start(name:

"table1",
label: "Notre Première Table",
overrides: "width=7.3 in frame=void rules=none" );
obj.row_start();
obj.format_cell(data:

"OBJECTIF" ,
column_span: 2 ,
overrides: "just=left vjust=middle backgroundcolor=green color=white
font_face='Calibri' font_weight=bold font_size=13pt");
obj.row_end();
obj.table_end();
obj.layout_end();
Run;

ODS PDF CLOSE;

 

Thank you very much!

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

1. Please paste the code using the "insert SAS code" icon

2. It'd be nice if we could run the code. Can you modify it to use a SASHELP table?

SASdevAnneMarie
Barite | Level 11

OPTION NODATE NONUMBER;
OPTIONS PAPERSIZE=A4;
OPTIONS TOPMARGIN=0.5 in BOTTOMMARGIN=0.5 in LEFTMARGIN=0.5 in RIGHTMARGIN=0.5 in;
ODS NORESULTS;
ODS PDF FILE = "XXXXXX\TEST.pdf" dpi=1800;

data _NULL_;
	set SASHELP.CLASS(obs=1);
	declare odsout obj();
	obj.layout_absolute(columns:1 );
obj.line(style_attr:
	"bordercolor=green", size:'0.8mm');
obj.region(width:
	"3.5 in",x:"3.5 in",height:"1.2 in",y:"0.2 in" ,style_attr: "bordercolor=cx338AFF");
	obj.format_text( data: "Information",
		overrides: " just=left color=green font_weight=bold font_size=24pt ");
obj.region(width:
	"7.3 in" ,height:"8 in",y:"1.4 in", style_attr: "");
obj.line(style_attr:
	"bordercolor=green ", size:'0.8mm');
obj.table_start(name:

	"table1",
	label: "Notre Première Table",
	overrides: "width=7.3 in frame=void rules=none" );
	obj.row_start();
obj.format_cell(data:

	"OBJECTIF" ,
	column_span: 2 ,
	overrides: "just=left vjust=middle backgroundcolor=green color=white
	font_face='Calibri' font_weight=bold font_size=13pt");
	obj.row_end();
	obj.table_end();
	obj.layout_end();
Run;

ODS PDF CLOSE;

Hello Chris,

 

Thank you for a nice suggestion (I did not notice the "insert SAS code" icon  🙂

Yes, I can use SASHELP.CLASS for this programme.

 

 

Thank you very much!

 

ChrisNZ
Tourmaline | Level 20

Sadly my version of SAS seems too old to support your code 😞

WARNING: Invalid parameter 'COLUMNS' for method 'LAYOUT_ABSOLUTE'. Parameter will be ignored.
WARNING: WIDTH exceeds available space for PDF destination. This option will be ignored.

I am sure someone else will help.

SASdevAnneMarie
Barite | Level 11
Hello Chris,
Thank you!
I get the same warnings while the executing, but I get the pdf file.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1170 views
  • 1 like
  • 2 in conversation