Published on :

Sans titre

This code is also available in: Deutsch Español Français
Awaiting validation
Data Analysis

Type : MIXTE


Data 'one' internally generated via DATALINES and usage of the standard example table 'sashelp.class'.

1 Code Block
DATA STEP Data
Explanation :
Creation of a temporary dataset named 'one' containing three variables (x, y, z) with embedded data (cards/datalines).
Copied!
1DATA one;
2 INPUT x y z;
3 CARDS;
41 10 1
52 20 1
63 30 1
71 40 2
82 50 2
93 60 2
101 10 3
112 20 3
123 30 3
131 40 4
142 50 4
153 60 4
16;
17RUN;
2 Code Block
PROC GCHART
Explanation :
Initialization of the ODS 'tagsets.htmlpanel' destination to create an HTML file 'gbypanel.html'. Configuration of graphic options (GOPTIONS) and generation of a vertical bar chart (vbar) for each value of the 'z' variable (BY-group processing).
Copied!
1ods tagsets.htmlpanel path="." (url=none) file="gbypanel.html";
2goptions dev=javaimg xpixels=480 ypixels=320;
3 
4title1 "A by-group test";
5title2 "with a second title";
6footnote1 "A Footnote";
7footnote2 "A Second Footnote";
8 
9PROC GCHART DATA=one;
10 BY z;
11 vbar x / sumvar=y pattid=midpoint discrete;
12RUN;
13QUIT;
3 Code Block
PROC PRINT
Explanation :
Execution of a print procedure (PROC PRINT) on the sashelp.class table. This step effectively breaks the previous graphical paneling flow.
Copied!
1/* table stops the paneling */
2PROC PRINT
3DATA=sashelp.class;
4RUN;
5 
4 Code Block
PROC GCHART
Explanation :
Generation of a new series of charts, this time horizontal bar charts (hbar), still grouped by the 'z' variable.
Copied!
1PROC GCHART DATA=one;
2 BY z;
3 hbar x / sumvar=y pattid=midpoint discrete;
4RUN;
5QUIT;
5 Code Block
PROC GCHART
Explanation :
Modification of graphical dimensions via GOPTIONS and generation of a simple horizontal bar chart on the sashelp.class table (without BY-group), which stops the previous paneling.
Copied!
1/* This graph stops the paneling */
2goptions dev=javaimg xpixels=640 ypixels=480;
3title1 "A Gchart Output";
4footnote1 "with a footnote";
5PROC GCHART DATA=sashelp.class;
6 hbar age / sumvar=height;
7RUN;
8QUIT;
6 Code Block
PROC PRINT
Explanation :
Final printing of the sashelp.class table with a new title, followed by closing all open ODS destinations.
Copied!
1title1 "A PROC PRINT Table";
2PROC PRINT DATA=sashelp.class;
3RUN;
4 
5ods _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.