The script begins by initializing ODS options for graphical output (output path, DPI resolution). It then defines a reusable graph template (`STATGRAPH Terminology`) via `PROC TEMPLATE`. This template includes a title, a footnote, a two-row lattice layout, an overlay graph combining a histogram and density curves (normal and kernel) with a legend, and a horizontal box plot. Finally, `PROC SGRENDER` is used to apply this template to `sashelp.heart` data, filtered for individuals with 'ageatstart' greater than 50, and to visualize the 'Systolic' variable as a dynamic variable.
Data Analysis
Type : SASHELP
The script uses the internal SASHELP.HEART dataset. A filter is applied to select records where 'ageatstart' is greater than 50.
1 Code Block
Macros / ODS
Explanation : Initializes ODS (Output Delivery System) options for graph generation. Defines the output path (`gpath`) and image resolution (`dpi`). The default HTML destination is closed to avoid unwanted output and ensure that only graphical output is produced.
Copied!
%let gpath='.'; /*--Put your Folder Name here--*/
%let dpi=300;
ods listing style=listing image_dpi=&dpi gpath=&gpath;
ods html close;
Explanation : Defines a graph template named 'Terminology' using the SGPLOT language. This template creates a complex graph composed of a title, a footnote, a histogram, density curves (normal and kernel) with a discrete legend, and a box plot. It is designed to accept a dynamic variable `_var` which will be specified when calling the template.
Explanation : Configures ODS graphical options for output (no border, 4-inch width, image name). Calls the previously defined 'Terminology' STATGRAPH template, providing it with `sashelp.heart` data (filtered for 'ageatstart > 50') and assigning the 'Systolic' variable to the template's dynamic `_var` variable. This generates and exports the final graph.
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.
Related Documentation
Aucune documentation spécifique pour cette catégorie.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.