Hi mrom34, What you're doing is possible. I've done something very similar a number of times and know exactly what you're talking about with IE. I'm assuming what you are after is a 'Would you to open or save this spreadsheet file' type response from your browser when you run your stored process. If this is the case, from my understanding IE especially insists that any MIME content is displayed standalone in an iframe or its own window. Browsers generally won't allow you to reset the header halfway through the transmission of the page, as you're doing above. You're correct - you can't use multiple MIME headers. This is set at the beginning of your _webout stream. I have a couple of suggestions for you, and these assume that the program is to be used by multiple users concurrently: - firstly, make this a stored process that recursively calls itself, and works in a way that outputs the HTML if certain (or no) parameters are passed, and outputs your mime headers and the ODS markup if another paremeter is present. Let me explain with some pseudocode (only the second half is real code): * if no filenameParameter parameter is passed to this stored process; %if (%length(&filenameParameter < 3) (or symexist, or whatever works for you)) do; myTempFilename = fn || ranuni() || '.xls'; * generate a random filename string with whatever method you choose ; ods tagsets file=myTempFilename; * write the temporary generated excel filename to disk somewhere in a temp location; * output the put statements above to _webout; * then output something like this html, no need for a popup; put '<iframe src="myserver/SASStoredProcess/do?_program=/myDownloader?filenameParameter=' || myTempFilename || ' "></iframe>'; end; * if the filename paremeter is present, which it will be when called the second time via iframe reference above; else if length(filenameParameter > 3) then do; filename myFileInput="/myTempFileLocation/&filenameParameter..xml"; %let RV=%sysfunc(stpsrv_header(Content-type,application/vnd.ms-excel)); %let RV=%sysfunc(stpsrv_header(Content-disposition,attachment; filename= Histostaffperformance.xml)); data outmenow; length data $1; infile myFileInput recfm=n; file _webout recfm=n mod; input data $char1. @@; put data $char1. @@; run; * here you can delete your file myfileinput so that the program cleans up after itself; end; This way, your program can take user parameters during the first run, use these to create your output file, and then send the browser an instruction to load that same temporary file as the only output of a stored process stream by calling itself again using that iframe reference and the unique temp file string which tells it this is a download request for a previously constructed file, and because the new request uses fresh mime headers and a simple stream of the file contents, it'll come up as a download request. Also, rather than wrapping each line of your html/javascript in put statements, it's much easier to write any static code to a static file and read it out using data step. Something like: data _null_; infile myStaticCodeStoredSomewhere.js; file _webout; put _infile_; run; ... will work well for the first half of your program, in place of the put statements. This way you also don't have to worry about quoting etc., and it's a lot easier to edit. Hope this helps you and anyone else trying to achieve something similar. Nik
... View more