I have a problem when using the sas report writing interface to create a pdf file. My table has a column need a long header, so I split it into two lines. however, there will be an extra space generated in the first row. Please look at the sample pdf and see the difference between the first row of two table header. the only difference of the code to create the two tables is the second table use a split header "Student*Name" in first column. how can I remove the extra space in second table? Thanks in advance! below is my code of the example options nodate nonumber;
ods listing close;
ods pdf file="test.pdf" startpage=never;
title "Table Using Column and Row Spanning";
title2 "Two Tables, One for Females and One for Males";
proc format;
value $gender
F = "Females"
M = "Males"
;
run;
proc sort data=sashelp.class out=class;
by sex;
run;
data _null_;
set class;
where sex = 'F';
by sex;
if _N_ = 1 then do;
dcl odsout obj();
end;
if first.sex then do;
obj.table_start();
obj.head_start();
obj.row_start();
obj.format_cell(data: "Name", row_span: 2, vjust: "M");
obj.format_cell(data: sex, column_span: 4, format: "$gender.");
obj.row_end();
obj.row_start();
obj.format_cell(data: "Age");
obj.format_cell(data: "Height");
obj.format_cell(data: "Weight");
obj.format_cell(data: "BMI");
obj.row_end();
obj.head_end();
end;
bmi = ( weight / ( height * height ) ) * 703;
obj.row_start();
obj.format_cell(data: name);
obj.format_cell(data: age);
obj.format_cell(data: height);
obj.format_cell(data: weight);
obj.format_cell(data: bmi, format: "8.2");
obj.row_end();
if last.sex then do;
obj.table_end();
end;
run;
data _null_;
set class;
where sex='F';
by sex;
if _N_ = 1 then do;
dcl odsout obj();
end;
if first.sex then do;
obj.table_start();
obj.head_start();
obj.row_start();
obj.format_cell(data: "Student*Name", split: '*', row_span: 2, vjust: "M");
obj.format_cell(data: sex, column_span: 4, format: "$gender.");
obj.row_end();
obj.row_start();
obj.format_cell(data: "Age");
obj.format_cell(data: "Height");
obj.format_cell(data: "Weight");
obj.format_cell(data: "BMI");
obj.row_end();
obj.head_end();
end;
bmi = ( weight / ( height * height ) ) * 703;
obj.row_start();
obj.format_cell(data: name);
obj.format_cell(data: age);
obj.format_cell(data: height);
obj.format_cell(data: weight);
obj.format_cell(data: bmi, format: "8.2");
obj.row_end();
if last.sex then do;
obj.table_end();
end;
run;
ods pdf close;
ods listing;
... View more