DATA Step, Macro, Functions and more

A question about ods tagsets.excelxp

Reply
Contributor
Posts: 25

A question about ods tagsets.excelxp

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.


ODS01.JPG
Super User
Posts: 10,516

Re: A question about ods tagsets.excelxp

Try using the Sheet_label option instead.

Contributor
Posts: 25

Re: A question about ods tagsets.excelxp

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!!!

Super User
Posts: 17,868

Re: A question about ods tagsets.excelxp

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');

Contributor
Posts: 25

Re: A question about ods tagsets.excelxp

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.

Contributor
Posts: 25

Re: A question about ods tagsets.excelxp

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.

SAS Super FREQ
Posts: 8,743

Re: A question about ods tagsets.excelxp

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

Contributor
Posts: 25

Re: A question about ods tagsets.excelxp

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.


Ask a Question
Discussion stats
  • 7 replies
  • 366 views
  • 0 likes
  • 4 in conversation