Moon
Moon

Reputation: 20022

Display webout HTML generated by data steps in a SAS Web Report Studio

Here is how I build reports for SAS EnterpriseGRC:

For example my code would look like:

proc sql noprint;
CREATE TABLE work.risks AS
SELECT *
FROM opdetail.risk_L;
quit;

data _null_;
 file _webout;
 put '<html>';
 put '<body>';
 put '<table>';
 put '<tr><td>Risk ID</td><td>Risk RK</td></tr>'
run;

data _null_;
set work.risks;
 put '<tr>';
 put '<td>'; put risk_id;'</td>'
 put '<td>'; put risk_rk;'</td>'
 put '</tr>';
run;

data _null_;
 put '</table>'; 
 put '</body>'; 
 put '</html>';
run;

Now this is a very simplistic approach but a very effective one since I can theoretically represent my data in any complicated form like a correlation heat etc, as much as HTML allows

Now this technique has only one problem. Clients have a problem printing this report from within EGRC. The code I have written produces a stream output so I cant use this STP in a SAS Web Report Studio report where printing options are available. How can I solve my printing problem in the least complicated way?

p.s I know can build Informationmaps and build reports like they are supposed to but sometimes clients request demands a format of report which SAS Web Report Studio can not handle.

I could put this Print This Page in the HTML, but that puts date and page title on the top of printing page which is out of my control.

Upvotes: 2

Views: 1001

Answers (2)

Allan Bowe
Allan Bowe

Reputation: 12701

Well the simplest way to print your _stream'd html report is via your trusty web browser!

Simply navigate to www.YOURSASMIDTER/SASStoredProcess and select "List Available Stored Processes and Reports". When you find your STP, right click and open in a new tab.

You now have your html report, and the URL which can be shared with end customers - who can apply your registered filters, and print your report in their browser of choice.

Of course this is not a the recommended way to build web based reports with SAS. Your SAS code will get overcomplicated by many / complex put statements (mixing SAS code with html/css/javascript). You will also struggle to apply the thousands of excellent libraries that can jazz up your report (such as highcharts, handsontable, d3).

If you are happy to deliver your reports purely from the browser (instead of EGRC) then a suggested / more scaleable approach is to use the open source SASjs adapter. More info at https://sasjs.io

Upvotes: 0

Moon
Moon

Reputation: 20022

Well the least complicated way was to put a javascript print function through HTML inside the report. Though if someone IS still looking for a proper solution than ODS is the answer

Upvotes: 0

Related Questions