SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

Renaming worksheets when using libname statement for creating Excel files

Reply
Contributor
Posts: 20

Renaming worksheets when using libname statement for creating Excel files

Hi,

I would like to rename the individual worksheets when creating Excel files using the libname statement so that the name of the sheet does not have to be equal to the name of the dataset. Is there an option similar to the sheet='YY' option in PROC Export?

Here's a code sample:

libname outxls excel 'H:\HLI\example_out2.xls' ;
data outxls.report_2009 (dblabel=yes);
set sasuser.report_2009;
run;
LIBNAME outxls CLEAR;

Thanks,

Helle
SAS Super FREQ
Posts: 8,719

Re: Renaming worksheets when using libname statement for creating Excel files

Hi:
If you did this:
[pre]
libname outxls excel 'H:\HLI\example_out2.xls' ;

data outxls.wombat (dblabel=yes);
set sasuser.report_2009;
run;

LIBNAME outxls CLEAR;
[/pre]

Then the name of the sheet would be 'wombat'....there is no sheet= option such as that used with PROC EXPORT.

cynthia
Contributor
Posts: 20

Re: Renaming worksheets when using libname statement for creating Excel files

Hi Cynthia,

Thanks for bringing this very obvious solution to my attention :-)

Helle
Ask a Question
Discussion stats
  • 2 replies
  • 198 views
  • 0 likes
  • 2 in conversation