The script uses two data sources: SASHELP.CLASS (a demonstration dataset built into SAS) and an internal dataset 'one' created directly in the script via a DATALINES statement (CREATION_INTERNE).
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates a dataset named 'one' using inline data (DATALINES/CARDS). It contains three variables (x, y, z) and 12 observations, intended for later use in group analyses.
Explanation : This block initializes the ODS TAGSETS.HTMLPANEL destination to create an HTML file ('gpanelall.html') that will act as a container for the graphs. The 'panelcolumns' and 'panelborder' options define the panel layout. GOPTIONS configures graphic parameters, specifying the device driver (JAVAIMG) and pixel dimensions for the generated images.
Explanation : This block defines global titles (title1, title2) and footnotes (footnote1, footnote2) that will be applied to subsequent graphic outputs, except for those specifically canceled or replaced.
Copied!
title1 "Health analysis";
title2 "using Gchart and Gplot";
footnote1 "A footnote";
footnote2 "A second footnote";
1
title1 "Health analysis";
2
title2 "using Gchart and Gplot";
3
footnote1 "A footnote";
4
footnote2 "A second footnote";
4 Code Block
PROC GCHART / PROC GPLOT
Explanation : This block activates ODS HTMLPANEL's automatic paneling mode. Several graphic procedures are executed consecutively: two PROC GCHART (vertical and horizontal bar charts of age and weight/height) and two PROC GPLOT (scatter plots of weight vs height and height vs weight). All these graphic outputs will be automatically grouped into a panel in the final HTML file. SYMBOL statements define markers and colors for GPLOT graphs.
Explanation : This block generates a simple table using PROC PRINT to display the content of the SASHELP.CLASS dataset. A new title is defined specifically for this table, replacing previous titles.
Copied!
title1 "A PROC PRINT Table";
proc print data=sashelp.class;
run;
1
title1 "A
2
PROC PRINT Table";
3
PROC PRINT
4
DATA=sashelp.class;
5
RUN;
6
6 Code Block
PROC GCHART (BY-group)
Explanation : This block creates a vertical bar chart (vbar) with PROC GCHART. The BY Z statement indicates that the graph will be generated separately for each unique value of the 'z' variable in the 'one' dataset, allowing for group analysis. The graph displays the sum of 'y' by 'x'.
Copied!
title1 "A by-group";
proc gchart data=one;
by z;
vbar x / sumvar=y pattid=midpoint discrete;
run;
quit;
1
title1 "A by-group";
2
PROC GCHARTDATA=one;
3
BY z;
4
vbar x / sumvar=y pattid=midpoint discrete;
5
RUN;
6
QUIT;
7 Code Block
ODS _ALL_ CLOSE
Explanation : This statement closes all currently open ODS destinations, including ODS TAGSETS.HTMLPANEL, thus finalizing the creation of output files.
Copied!
ods _all_ close;
1
ods _all_ close;
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.