ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
FrankE
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"));

                              %STPBEGIN;

proc print data=sashelp.cars;

                              run;

%STPEND;

Any idea how I might do that?

Thanks!

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:

  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);

run;

    

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)

style(table)=

     {posthtml=

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

run;

   

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.

cynthia

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1242 views
  • 0 likes
  • 2 in conversation