Excel not being created

LuckyLucks
LuckyLucks used Ask the Experts™
on
Hi, I have written a code below to create a excel from sas with all the data in the data set and customized header and footer but I am getting an error as below. Please note that I am using sas 9.1. Not sure why the excel is not being created.


 ods targets.ExcelXP
168  options(embedded_title='yes'
169          embedded_footnotes='yes'
170          print_header='&RPrinted &D at &T'
171          print_footer='sign:______ date:______');
WARNING: Tagset TARGETS.EXCELXP not found; the default tagset will be used instead.
WARNING: No body file. TARGETS.EXCELXP output will not be created.
172  ods targets.ExcelXP options(sheet_name='First');
WARNING: Tagset TARGETS.EXCELXP not found; the default tagset will be used instead.
WARNING: No body file. TARGETS.EXCELXP output will not be created.
173  proc print data=work.mydata; run;

NOTE: There were 3 observations read from the data set WORK.MYDATA.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


173!                                   quit;


 
ods targets.ExcelXP 
options(embedded_title='yes'
        embedded_footnotes='yes'
        print_header='&RPrinted &D at &T'
        print_footer='sign:______ date:______');   
ods targets.ExcelXP options(sheet_name='First');
proc print data=work.mydata; run; quit;

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Risk Manager
Commented:
I believe you have a typo causing this issue.

It should be tagsets.ExcelXP, not targets.ExcelXP

Cheers,
WC
ods tagsets.ExcelXP 
options(embedded_title='yes'
        embedded_footnotes='yes'
        print_header='&RPrinted &D at &T'
        print_footer='sign:______ date:______');   
ods tagsets.ExcelXP options(sheet_name='First');
proc print data=work.mydata; run; quit;

Open in new window

Commented:
You also need to close the ods tagsets before you can view the output.
I also found that by default SAS created an html page. So use the fille = "c:\myfolder\myexcel.xls" statement to specify where you're outputing to and that it is an Excel file.

Try this, it worked for me :-)
ods tagsets.ExcelXP
    file="myexcel.xls"
options(embedded_title='yes' 
        embedded_footnotes='yes' 
        print_header='&RPrinted &D at &T' 
        print_footer='sign:______ date:______');    
ods tagsets.ExcelXP options(sheet_name='First'); 
proc print data=work.mydata; run; quit;
ods tagsets.ExcelXP close;

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial