BookmarkSubscribeRSS Feed
Fluorite | Level 6



I'm developing sas stored procedures to get attached in web portal to display data automatically in Excel. But i am getting error while running this code. Can anyone help me with the code which i can include in my stored procedure to get output automatically in excel ?



Good luck to me 🙂

Super User

@v9dduhan wrote:



But i am getting error while running this code.


And a sack of rice dropped in China.


You need to be MUCH more specific to get help.

- log (excerpt) with code and ERROR(s)

- what are you trying to achieve in detail?

  (Loading in Excel through Add-In, automatic creation of Excel file, ...)

- what is your SAS setup (1-2-3 tier, involved operating systems)?

Fluorite | Level 6

Here is code:


%global make;

%global type;

proc sql;

create table t1 as

select *


where make = "&make."

and type = "&type.";


ods tagsets.ExcelXP file='c:\test1.xlsx';

proc report data=work.t1;




This is error:



28 ods tagsets.ExcelXP file='c:\test1.xlsx';

NOTE: Writing TAGSETS.EXCELXP Body file: c:\test1.xlsx

ERROR: Insufficient authorization to access /sas/EBIServer/Lev2/SASApp_Prod/c:\test1.xlsx.

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

29 proc report data=work.t1;

30 run;



I want to get output in temporary excel file on same system from which this stored procedure invoked.


Here i'm just testing using "C:" drive of my system, but this should be temporary file location.


Any suggession ?

Super User

->  ERROR: Insufficient authorization to access /sas/EBIServer/Lev2/SASApp_Prod/c:\test1.xlsx.


So you have at least a 2-tier SAS setup (server and client), and the server runs on UNIX.

The working directory for the SAS server process is /sas/EBIServer/Lev2/SASApp_Prod, and a normal user (or sassrv, which runs pooled servers like the stored process server) must not have write access there.


Necessary actions by you:

- define (or have defined) a location on the server where such temporary files can be written. Make sure that the users involved have write permisison there

- use UNIX style filename/pathname syntax. Look here:

- after creating the file, you need to download it to your PC. WinSCP is a tool for this. Or you create the STP in a way that it sends the ouput directly, using proper HTML code, so the browser knows what to do with the result.


Fluorite | Level 6

Thanks @Kurt_Bremser for making me understand the problem and structure. Can you please help with the code as well through which i can send output directly to location. I am not good in html coding, but i will try. can you give me general structure in stored procedure perspective which will send output to location.


Thank you so much

Super User

First of all, get a simple step running before trying your hand at stored processes.


One location that is surely writable by you is your UNIX home directory.


So modify your code like this:

ods tagsets.ExcelXP file='$HOME/test1.xml';

proc report data=work.t1;

ods tagsets.excelxp close;

Once that step runs without ERRORs or WARNINGs, start WinSCP or similar, log on to the SAS server (using ypur SAS credentials), and you'll find the test1.xml.

(I used .xml because tagsets.excelxp creates a XML file, and Excel from 2010 on complains if the filename extension does not match the contents)


Fluorite | Level 6

Still getting error:


NOTE: The address space has used a maximum of 1148K below the line and 57760K above the line.


24 %let _odsdest=excel;


26 ods tagsets.ExcelXP file='$HOME/test1.xml';

NOTE: Writing TAGSETS.EXCELXP Body file: $HOME/test1.xml

ERROR: A component of /usr/lpp/SAS_R93M2/config/Lev2/SASApp_SYSA/$HOME is not a directory.

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

27 title 'SASHELP.Class';

28 proc report data=work.t1;

29 run;


Rhodochrosite | Level 12

You need to direct the output to the reserved _WEBOUT FILEREF.  Review page 18 of this paper:


Then try something like this:



ods _all_ close;

%let RV=%sysfunc(appsrv_header(Content-type,application/;
%let RV=%sysfunc(appsrv_header(Content-disposition,attachment; filename="t1.xml"));

ods tagsets.ExcelXP file=_webout;
  proc report data=work.t1 nowd; run; quit;
ods tagsets.ExcelXP close;



Vince DelGobbo




Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 3 in conversation