BookmarkSubscribeRSS Feed
Fluorite | Level 6

Hi guys,

I'm trying to produce an XML file via ODS and return it to the user with an open/save as box in a stored process. 

This code returns an XML file but it contains the log, not the dataset:

%let _ODSDEST = XML;

                              %let rc = %sysfunc(stpsrv_header(Content-type,text/xml));

                              %let rc = %sysfunc(stpsrv_header(Content-disposition,"attachment; filename=c:\temp\temp.xml"));


proc print;



Any idea how I might do that?




  You might want to ask this question in the stored process forum or work with Tech Support. Generally speaking, however, buttons and choices are something you can add to HTML results. (as described for ODS HTML on this site: ) not necessarily to XML results. In addition, if you change the automatic variable _ODSDEST to just XML, you will get "generic" XML. The BI Platform mostly uses SASReport XML -- which is different than "plain" XML. You can prove this to yourself by doing this:


ods xml file='c:\temp\generic.xml';

ods tagsets.sasreport12 file='c:\temp\srx.xml';


proc print;



ods _all_ close;

And then look at the difference between the 2 output files with Notepad or Textpad. You should see different XML in each of the above files. But, if I want to add a button to an output, I generally use HTML as the output destination and use HTML, as described in this note to put a button on the bottom of the page.

For example, if I wanted to put a PRINT button at the bottom of my output, I could do this, in "regular" SAS (not as a stored process):

ods html file='c:\temp\addbutton.html';


proc print



      '<div align="center"><input type="button" value="PRINT PAGE" onclick=javascript:window.print()></div>'} ;



ods html close;

If I turned the above program into a stored process, I could only expect the PRINT button to show up if I ran the stored process in a web browser. For example, it would be inappropriate for an HTML "onclick" PRINT button to show up in PowerPoint or Web Report Studio. Not all client applicatioins receive HTML or HTTP protocol output from stored processes.

I think that you might want to work with Tech Support on this task. They can clarify what you want to do with the XML and see if XML is the right value for _ODSDEST in your stored process. I suspect you will need to change _ODSDEST to one of the HTML-based destinations. I would not expect an HTML DIV tag or INPUT tag to work within the context of XML results.



Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation