I wrote this code to see how different, if different, the other spreadsheets would be, using SASHELP.CARS. The answer was yes it allows different alignments. It attempts to autofit column widths to the data. But it doesn't do it well IMO. SAS doesn't "know" what your Excel's default font is so it, I believe, makes a conservative guess. Another way to put it, SAS can't Autofit column widths like Excel, it must calculate the column widths, with an educated guess, before Excel is open to view the file. The question becomes, to me, how do you get to SAS to fit column widths well... as well as Excel?
ODS TAGSETS.EXCELXP did this job better. It had the option WIDTH_FUDGE. On my Excel, with the font I use, I always set WIDTH_FUDGE=0.7. I was almost always, 99.99%, happy with its choice of automatically calculated column widths. You might try TAGSETS.EXCELXP.
data cars;
retain N (0);
set sashelp.CARS;
by Make;
if first.Make
then N+1;
run;
%MACRO Rpt /parmbuff;
ODS Excel
OPTIONS (Orientation = 'landscape'
sheet_name = "OB List"
sheet_interval = 'Proc'
embedded_titles='yes'
AUTOFILTER ="All"
FLOW="TABLES"
ROW_HEIGHTS="39, 18");
ods listing close;
proc print NoObs data=work.Cars(obs=30);
where &syspbuff;
var _all_;
run;
%Mend;
%macro byMake;
%do n=1 %to 3;
ODS Excel
OPTIONS (Orientation = 'landscape'
sheet_name = "OB List"
sheet_interval = 'Proc'
embedded_titles='yes'
AUTOFILTER ="All"
FLOW="TABLES"
ROW_HEIGHTS="39, 18");
%Rpt(N=&n)
%end;
%Mend;
ODS Excel file="test.xlsx";
%Rpt(1);
%byMake;
ODS EXCEL CLOSE;
... View more