I need to define column width to standardize the look of the report. However, when I set the column width it automatically expands the row height for each cell. I tried setting the cellheight in various places in the code but I can't seem to constrain it. How is this done?
Here's an example using the sashelp.cars dataset that gives me the same results.
@Ryanb2 wrote:
I need to define column width to standardize the look of the report. However, when I set the column width it automatically expands the row height for each cell. I
Are you talking about values such as Model that have long text such as "3.5 RL w/Navigation 4dr" that wrap text to another line because it is too long to fit in space provided?
If so, what do you want to happen? Cutoff the extra text? Not wrap the text?
Note: SASHELP.CARS has MPG_City and MPG_Highway but not "MPG" as variables.
I'm afraid that you will have to more clearly describe, or provide a better data set, that demonstrates your specific concern.
Your comment "egregious extra space" without a concrete example isn't clear enough to code.
The ExcelXP (or other formats) generally will attempt to "dynamically fit" text into provide width columns by wrapping text too long to fit in a defined report column width. XML files may have an issue with which specific file viewer you use though. If you haven't looked at the generated XML in a text viewer you should to see just how much default stuff is set that the viewer gets to interpret.
Any particular reason you are using ODS ExcelXP for output?
You could use option "Row_Heights=".
ODS TAGSETS.EXCELXP
file="C:\temp\test.xls"
STYLE=Printer
OPTIONS (
Sheet_Name = "NEW"
Orientation = 'landscape'
FitToPage = 'no'
Pages_FitWidth = '1'
Pages_FitHeight = '100'
embedded_titles = 'yes'
Row_Heights='0,40,0,0,0,0,0'
) ;
PROC REPORT DATA=sashelp.cars nowd
style(header)=[fontfamily=helvetica fontsize=8pt textalign=l]
style(column)=[fontfamily=helvetica fontsize=8pt textalign=l TAGATTR='format:text'];
columns make model type origin msrp drivetrain horsepower mpg;
DEFINE mpg / STYLE(column)={cellwidth=10cm};
RUN;
ods tagsets.excelxp close;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.