Published on :
Reporting SASHELP

Multi-file HTML Report Generation with ODS

This code is also available in: Deutsch Español Français
Awaiting validation
This script uses the Output Delivery System (ODS) to create an HTML report composed of files for the body, table of contents, and frames. It attempts to sort the SASHELP.PRDSALE table (which will generally fail because SASHELP is read-only without an 'out=' option) then print it. The script contains Windows paths and a 'dm' command specific to PC SAS©, natively incompatible with a standard SAS© Viya Linux environment.
Data Analysis

Type : SASHELP


Uses the standard SASHELP.PRDSALE table containing sales data.

1 Code Block
ODS
Explanation :
Initialization of the ODS HTML destination with specification of target files for the frameset structure.
Copied!
1ods html body='c:\body.html'
2 contents='c:\contents.html'
3 page='c:\page.html'
4 frame='c:\frame.html' ;
2 Code Block
PROC SORT Data
Explanation :
Attempt to sort data by country and region. Note: Without the 'OUT=' option, this procedure attempts to modify the source table, which will cause an error if SASHELP is read-only.
Copied!
1 
2PROC SORT
3DATA=sashelp.prdsale ;
4BY country region ;
5 
3 Code Block
PROC PRINT
Explanation :
Display of (theoretically sorted) data grouped by country and region in the HTML report.
Copied!
1 
2PROC PRINT
3DATA=sashelp.prdsale ;
4BY country region ;
5RUN ;
6 
4 Code Block
ODS
Explanation :
Closing the ODS HTML destination to finalize file writing. The 'dm' command attempts to open the internal browser (specific to the classic Windows interface).
Copied!
1ods html close ;
2dm "wbrowse 'c:\frame.html'" ;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.