The script initializes the Output Delivery System (ODS) to produce graphical output. It defines a statistical graph template (`STATGRAPH`) named `Fig_8_0_PatientProfile` using `PROC TEMPLATE`. This template arranges a scatter plot (cholesterol vs. systolic blood pressure) and bar/box plots (average weight, diastolic blood pressure by cause of death) in a lattice layout. Finally, `PROC SGRENDER` is used with the `sashelp.heart` dataset to apply this template and generate the resulting graph as an image.
Data Analysis
Type : SASHELP
The script uses the standard `sashelp.heart` dataset from SAS, which is provided with the SAS installation and does not require an external source or internal creation.
1 Code Block
ODS Setup
Explanation : This block initializes the Output Delivery System (ODS) options. It defines an output path for images (`gpath`), image resolution (`dpi`), and configures ODS output for HTML with an `htmlblue` style. The `ods html close;` command closes the default HTML destination to avoid conflicts when generating subsequent graphs.
Copied!
%let gpath='.'; /*--Put your Folder Name here--*/
%let dpi=300;
ods listing style=htmlblue image_dpi=&dpi gpath=&gpath;
ods html close;
Explanation : This block defines a statistical graph template (`STATGRAPH`) named `Fig_8_0_PatientProfile`. The template creates a lattice layout (`layout lattice`) with two columns. The first column contains a scatter plot (`scatterplot`) of cholesterol versus systolic blood pressure, grouped by sex. The second column is another lattice superimposing a bar chart (mean weight by cause of death and sex) and a box plot (diastolic blood pressure by cause of death and sex). Various style attributes are applied to enhance the readability and aesthetics of the graph.
Explanation : This block activates the `ods listing` destination and configures `ods graphics` with specific dimensions (`width`, `height`) and an image name (`imagename`). `PROC SGRENDER` is then used to generate the graph by applying the previously defined `Fig_8_0_PatientProfile` template to the `sashelp.heart` dataset. The result is a graphic image encapsulating the template.
Explanation : This block resets the global ODS titles and footnotes, ensuring they do not persist for subsequent ODS outputs.
Copied!
title;
footnote;
1
title;
2
footnote;
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.
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.