Published on :
Reporting SASHELP

GTL Scatter Plot with Left Labels

This code is also available in: Deutsch Español Français
This script uses PROC TEMPLATE to define a statistical graph template named 'rjText'. This template specifies a scatter plot crossing weight and height, grouped by sex. A particular feature is the display of data labels (names) positioned to the left of the points (DataLabelPosition=Left). The graph is then produced via PROC SGRENDER using a sample from the SASHELP.CLASS table.
Data Analysis

Type : SASHELP


The script uses the standard 'sashelp.class' table (limited to the first 10 observations).

1 Code Block
PROC TEMPLATE
Explanation :
Definition of the 'rjText' graph template via GTL. It configures a title and a layout containing a scatterPlot with specific options for data labels.
Copied!
1PROC TEMPLATE;
2 define statgraph rjText;
3 beginGraph;
4 entryTitle "Right-justified Text: using DataLabelPosition=Left";
5 layout overlay;
6 scatterPlot x=weight y=height / group=sex
7 dataLabel=name dataLabelPosition=left;
8 endLayout;
9 endGraph;
10 END;
11RUN;
2 Code Block
PROC SGRENDER
Explanation :
Execution of the graph rendering by applying the 'rjText' template to 'sashelp.class' data.
Copied!
1 
2PROC SGRENDER
3DATA=sashelp.class(obs=10) template=rjText;
4RUN;
5 
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.