我经常使用 SAS ODS 来导出漂亮的 Excel 文件。特别是其中一个标题的长度明显长于所有列的宽度,因此它们会自动换行,这使得文件看起来很糟糕。
有什么办法可以导出关闭自动换行的文件吗?我在 SAS 支持论坛上进行了搜索,但发现有用的信息很少。
%let myfile = "C:\Users\dicegods\testfile.xlsx";
ods excel file=&myfile. options (orientation='portrait' sheet_name='Baseball' embedded_titles='yes');
options LeftMargin=0.25in RightMargin=0.25in TopMargin=0.25in BottomMargin=0.25in;
proc report data=sashelp.baseball;
column name nHome nHits;
define name / display 'Name';
define nHome / display 'Homers' sum;
define nHits / analysis 'Hits' sum;
title; title1 J=L "Baseball Players from SAS Help Database - sashelp library inEG - more run on stuff";
run;
最佳答案
尝试使用 ODS TEXT。以下代码片段显示了使用 ODS TEXT 将“标题”插入到由以下 PROC 步骤生成的工作表顶部的简单方法。查找documentation在 ODS TEXT 上查看如何控制生成文本的格式
%let myfile = "C:\downloads\testfile.xlsx";
ods excel file=&myfile. options (orientation='portrait' sheet_name='Baseball' embedded_titles='no');
ods text="Baseball Players from SAS Help Database - sashelp library inEG - more run on stuff";
options LeftMargin=0.25in RightMargin=0.25in TopMargin=0.25in BottomMargin=0.25in;
proc report data=sashelp.baseball;
column name nHome nHits;
define name / display 'Name';
define nHome / display 'Homers' sum;
define nHits / analysis 'Hits' sum;
title J=L "Baseball Players from SAS Help Database - sashelp library inEG - more run on stuff";
run;
title;
ods excel close;
关于sas - ODS Excel/Proc 报告 - 没有自动换行/合并单元格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61256198/