SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 40159: How to name Microsoft Excel worksheets generated with the ExcelXP tagset

DetailsAboutRate It

You can name Microsoft Excel worksheets generated by the ExcelXP tagset using the SHEET_NAME= tagset option. Specifying the SHEET_NAME= option allows you to override the default naming convention. You can specify the sheet name using the syntax below.

ods tagsets.excelxp file="c:\temp\temp.xml" options(sheet_name="Testing");

proc print data=sashelp.class;
run;

ods tagsets.excelxp close;
image label

The sheet names can also be dynamically generated based on the BY group. You can use the SHEET_INTERVAL="BYGROUP" tagset option to have each sheet named based on the BY group. This will prefix the BY-variable name and the "=" in front of the value on the tab. You can remove the information prefixed in front of the tab by also adding the SHEET_LABEL=" " option, which has a null value.

proc sort data=sashelp.class out=temp;
   by age;
run;

ods tagsets.excelxp file="c:\temp\temp.xml" 
    options(sheet_label=" " sheet_interval="bygroup");

proc print data=temp;
   by age;
run;

ods tagsets.excelxp close;
image label


These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.