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
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.
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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.