ods listing close;
ods tagsets.excelxp file="F:\Citi_code\SAS\test.xls" style=printer options (sheet_name= 'Print');
proc print data=sashelp.class noobs;run;
ods tagsets.excelxp options (sheet_name='freq');
proc print data=sashelp.class noobs;var sex;run;
ods tagsets.excelxp close;
ods listing;
/*********************************************************/
I find that, options (sheet_name= 'Print') and options (sheet_name='freq') do not work,the sheets name are 'Table 1 - Data Set SASHELP.CLAS' and 'Table 2 - Data Set SASHELP.CLAS',do not display 'Print' and 'freq'.
Please help me.How can I get the sheets name?
Thanks in advance.
Try using the Sheet_label option instead.
I try this:
options (sheet_name= 'Print' sheet_label="Label_Print")
options(sheet_name='Freq' sheet_label="Label_Freq")
It still does not work!
I cann't believe!!!
This worked fine for me. What version of tagsets are you using and what version of SAS? You can get that from the log, mine is below.
Please post your log as well, if you're still having issues.
NOTE: This is the Excel XP tagset (Compatible with SAS 9.1.3 and above, v1.94, 09/09/12). Add
options(doc='help') to the ods statement for more information.
ods listing close;
ods tagsets.excelxp file="C:\Temp\test.xls" style=printer options (sheet_name="print");
proc print data=sashelp.class noobs;run;
ods tagsets.excelxp options (sheet_name="freq");
proc print data=sashelp.class noobs;var sex;run;
ods tagsets.excelxp close;
ods listing;
ods tagsets.excelxp options(doc='help');
Thanks a lot,Reeza.
I download excltags.tpl from http://support.sas.com/rnd/base/ods/odsmarkup/SAS 9.1 tagsets (.zip).
And add %include "E:\TDDOWNLOAD\tagsets_9.1\excltags.tpl" to the ods.It works.
Thanks.
Hi Reeza,
When running %include "E:\TDDOWNLOAD\tagsets_9.1\excltags.tpl",SAS will save TAGSET to SASUSER.TEMPLAT.
Do you know how to block saving?
Thanks very much.
Hi:
The template has to be saved someplace. SASUSER is the default location. If you do not want to write to SASUSER, then you can write the template to WORK using the ODS PATH statement. Something like this -- placed BEFORE your %include:
ODS PATH WORK.TMPL(update) SASUSER.TEMPLAT(update) SASHELP.TMPLMST(read);
will cause the WORK location to be the first location chosen for saving instead of SASUSER. If you are using SAS Enterprise Guide or the BI platform, you might want to investigate the use of the PREPEND option for ODS PATH, so you do not tamper with any template stores used by these products.
But, this does mean that EVERY time you want to use this version of TAGSETS.EXCELXP, you will have to rerun the template code. And, so will anyone who wants to replicate your results.
cynthia
Hi Reeza,
Thanks.I'm using SAS Enterprise Guide which installed on the server,and every time I run %include "E:\TDDOWNLOAD\tagsets_9.1\excltags.tpl", it return an error that cann't store TAGSET,so if the template has to be saved someplace,I have to write the template to WORK.
So I'll set ODS PATH WORK.TMPL(update) SASUSER.TEMPLAT(update) SASHELP.TMPLMST(read) before %include.
Thanks very much.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.