10-24-2011 12:28 PM
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 data=sashelp.cars;
Any idea how I might do that?
10-24-2011 04:48 PM
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: http://support.sas.com/kb/23/342.html ) 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 data=sashelp.cars(obs=3);
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 data=sashelp.cars(obs=2)
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.