Hi:
Proc Export creates a basic .XLS file. As far as I know, you cannot issue Microsoft Excel "menu" commands such as autofit from anywhere in PROC EXPORT syntax.
However, if you switched to using ODS TAGSETS.EXCELXP, you CAN specify column widths or a default column width for when the file is opened in Excel. This works because ODS TAGSETS.EXCELXP creates a Spreadsheet Markup Language XML file which contains a syntax for specifying column widths. This is different from PROC EXPORT, which exports SAS data to Excel binary format, but without any formatting instructions (such as font, color or column widths). TAGSETS.EXCELXP, on the other hand, has a way to specify DEFAULT_COLUMN_WIDTH, as well as ABSOLUTE_COLUMN_WIDTH -- which isn't exactly the same as AUTOFIT, but it does get you a bit closer to making columns wider when they need to be.
There's a chance that if you used OLE-DB or ODBC or DDE instead of PROC EXPORT, that there is also a way to specify column widths with those methods; however, I haven't done enough with those methods to know.
cynthia
here's a sample ODS TAGSETS.EXCELXP example using Default_Column_Width:
[pre]
ods tagsets.excelxp file='c:\temp\datafile.xls'
options(Doc='Help' Default_Column_Width='20')
style=egdefault;
** proc print step for your data file;
ods _all_ close;
[/pre]
This code will produce HELP information for TAGSETS.EXCELXP in the SAS log. For more information about TAGSETS.EXCELXP and the available options refer to this site:
http://support.sas.com/rnd/base/ods/odsmarkup/
http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_help.html