BookmarkSubscribeRSS Feed
laugonalo
Calcite | Level 5

Hi,

 

I am trying to create an excel document from data I have. I am using Base SAS 9.3

 

The code I am using for that is:

 

ods _all_ close;

ods tagsets.ExcelXP file='TEST2.xls' style=Printer path= '$HOME/' options(sheet_name="="DDJanYY");

proc tabulate data = TableTEST;

  .....

  .....[SPECIFICATIONS OF THE TABLE]

  .....

run;

ods tagsets.ExcelXP close;

 

However, when trying to create the excel document I have this error.

 

411 ods _all_ close;

Error opening file. File =/usr/users/uxxxxxxxx/TEST2.xls. System Error Code = 49.

412

413 ods tagsets.ExcelXP file='TEST2.xls' Path='/usr/users/uxxxxxxxx/' style=Printer

413! options(sheet_name="DDJanYY");

NOTE: Writing TAGSETS.EXCELXP Body file: TEST2.xls

ERROR: Invalid open mode.

ERROR: No body file. TAGSETS.EXCELXP output will not be created.

 

Where /usr/users/uxxxxxxxx/

is my HOME environment

 

[%let home = %sysget(HOME);

%put &home.;

/usr/users/uxxxxxxxx]

 

It looks to me as if I did not have writing permissions for my HOME environment but I don't know why.

 

I have tried to create the excel in a specified path I change instead of $HOME/, For example 'C:My documents\whatever\' but the error I get is something like this

 

411 ods _all_ close;

Error opening file. File =/usr/users/uxxxxxxxx/TEST2.xls. System Error Code = 49.

412

413 ods tagsets.ExcelXP file='TEST2.xls' Path='/usr/users/uxxxxxxxx/C:My documents\whatever\' style=Printer

413! options(sheet_name="DDJanYY");

NOTE: Writing TAGSETS.EXCELXP Body file: TEST2.xls

ERROR: Invalid open mode.

ERROR: No body file. TAGSETS.EXCELXP output will not be created.

 

Does anyone know why I get this error and how to solve it?

 

I am completely new to SAS and I apologize in advance if there are mistakes in my explanation.

 

Many thanks,

 

Laura

2 REPLIES 2
andreas_lds
Jade | Level 19

Move the path into the file option and skip the path option and remove unnecessary quotes:

ods tagsets.ExcelXP file='$HOME/TEST2.xls' style=Printer options(sheet_name="DDJanYY");

When posting code and log, please use the {i} or running-man icon to preserver formatting.

Kurt_Bremser
Super User

 

Which operating system does your SAS run on? I ask because I don't know a UNIX that is supported by SAS (AIX, HP-UX, Linux, Solaris) that does not have the home directories of users in /home per default.

While users must not have write permissions for the parent of their $HOME, write permission on $HOME is a must. I wonder how SAS managed to create a SASUSER for you.

 

Do you use SAS Display Manager, SAS Studio, or SAS Enterprise Guide? If EG, try to create a new folder in your Server List/SASApp/Files.

 

 

PS don't try to lie to Excel. The output of tagsets.excelxp is XML, so files should have an extension of .xml. Newer versions of Excel complain when you want to open a XML file with a .xls extension.

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 6483 views
  • 0 likes
  • 3 in conversation