BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
shlomiohana
Obsidian | Level 7
Hello, I am creating an Excel file using the following code.
The table in Excel starts from column B.
I want to minimize the width of the empty column A in Excel.
How do I do this?

The code:
%macro create_report(area=,sheet=);
ods excel options (sheet_interval="proc" sheet_name="&sheet." start_at="B1" embedded_titles='yes');
title justify=center bold height=12pt "REPORT TEST";
proc report data= work.ATM_LEUMI_HIZUI_P nowd
style(column)={just=right font_face="Arial" font_size=10pt background=white}
style(header)={background=cxD9E1F2 foreground=cx0F2B50 font_weight=bold font_size=10pt just=center};
column
'AREA'n
'BRANCH'n;
define 'AREA'n /display;
define 'BRANCH'n /display style(column)={cellwidth=110pt};
%if &area. ne ALL %then %do; where 'AREA'n="&area."; %end;
RUN;
%mend create_report;

ods excel file="/cifs/accounts/ATM_LEUMI_HIZUI.xlsx";
%create_report(area=ALL,sheet=HIZUY);
%create_report(area=NORTH,sheet=NORTH);
%create_report(area=SOUTH,sheet=SOUTH);
ods excel close;


Thanks.
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User
(ABSOLUTE_COLUMN_WIDTH ='number-list '| 'NONE') 


specifies the columnwidths. Lists widths to use for columns instead of allowing SAS todetermine the column width (measured widths). The number-list isa comma separated list of numbers. You can use 'NONE' toreset to the default. 

Default None. SAS determines the width. 
Example ods excel file='footer.xlsx'    
          options(absolute_column_width='16');
proc print data=sashelp.class(obs=5);
run;
ods excel close;

 

From the online help on ODS EXCEL. This sets the first column to 16. If you want to specify additional widths separate the values by columns in a list following absolute_column_width= such as ('1,12,45').

Columns to the right of the number specified are treated as default determined by SAS.

View solution in original post

2 REPLIES 2
ballardw
Super User
(ABSOLUTE_COLUMN_WIDTH ='number-list '| 'NONE') 


specifies the columnwidths. Lists widths to use for columns instead of allowing SAS todetermine the column width (measured widths). The number-list isa comma separated list of numbers. You can use 'NONE' toreset to the default. 

Default None. SAS determines the width. 
Example ods excel file='footer.xlsx'    
          options(absolute_column_width='16');
proc print data=sashelp.class(obs=5);
run;
ods excel close;

 

From the online help on ODS EXCEL. This sets the first column to 16. If you want to specify additional widths separate the values by columns in a list following absolute_column_width= such as ('1,12,45').

Columns to the right of the number specified are treated as default determined by SAS.

Ksharp
Super User

As @ballardw  showed you :

 

 ods excel file='c:\temp\footer.xlsx'    
          options(absolute_column_width='1,12,12,12,12,12,12' start_at="B1" embedded_titles='yes');
		  title justify=center bold height=12pt "REPORT TEST";
proc report data=sashelp.class(obs=5) nowd;
run;
ods excel close;

Ksharp_0-1744688728679.png

 

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
  • 2 replies
  • 495 views
  • 2 likes
  • 3 in conversation