Tagsets.excelxp Question

Accepted Solution Solved
Reply
Regular Contributor
Posts: 173
Accepted Solution

Tagsets.excelxp Question

Hello everyone,

I am using tagsets.excelxp to push a dataset from Unix to Excel.  I am trying to use a macro for the 'sheet_name' within the options as shown below.  The macro variable 'year' has the value of 2012 and it works everywhere else.  The proc report and the rest of the code works too.  The only issue is the sheet name is showing up in the output Excel as "&year" instead of the value it should be (2012).  Does anyone have any suggestions on how to use the macro variable on the 'sheet_name'?  I really appreciate any input you may have.  Thank you Smiley Happy

ods listing close;

ods tagsets.excelxp file = "&work_path.ytd_&year.xls"

     options(embedded_titles='No'

     sheet_interval= 'none'

     sheet_name='&year'

     gridlines='Yes'

     wraptex='Off'

     suppress_bylines = 'yes'

     )

     style=sansprinter;

proc report data = ******

******

ods tagsets.excelxp close;


Accepted Solutions
Solution
‎11-27-2012 05:22 PM
SAS Super FREQ
Posts: 8,866

Re: Tagsets.excelxp Question

Hi:

  Does the FILE= option reference to &YEAR work? I would expect that it works OK. You can figure this out, if you ask yourself, what is the difference betwen the specification for FILE= and the reference for SHEET_NAME=?

  One of the first rules of macro variable reference is that &MACVAR references will NOT resolve if enclosed in SINGLE quotes. Your suboption value for SHEET_NAME  could use DOUBLE quotes (like your FILE=).

  Give it a try.

cynthia

View solution in original post


All Replies
Solution
‎11-27-2012 05:22 PM
SAS Super FREQ
Posts: 8,866

Re: Tagsets.excelxp Question

Hi:

  Does the FILE= option reference to &YEAR work? I would expect that it works OK. You can figure this out, if you ask yourself, what is the difference betwen the specification for FILE= and the reference for SHEET_NAME=?

  One of the first rules of macro variable reference is that &MACVAR references will NOT resolve if enclosed in SINGLE quotes. Your suboption value for SHEET_NAME  could use DOUBLE quotes (like your FILE=).

  Give it a try.

cynthia

Regular Contributor
Posts: 173

Re: Tagsets.excelxp Question

Posted in reply to Cynthia_sas

Thank you Cynthia!  I changed the single quotes to double quotes and it worked!

I really appreciate your help! Smiley Happy

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 188 views
  • 0 likes
  • 2 in conversation