SAS Scatter Plot – Learn to Create Different Types of Scatter Plots in SAS

Job-ready Online Courses: Dive into Knowledge. Learn More!

Previously, we learned about boxplot in SAS for analysis and representation of data, now we will move on to SAS scatter plot. We will learn to create different types of scatter plots in SAS.

So, let us get started.

What is SAS Scatter plot?

A scatter plot in SAS Programming Language is a type of plot, graph or a mathematical diagram that uses Cartesian coordinates to display values for two variables for a set of data. Below are representations of the SAS scatter plot.

SAS Scatter Plot Example 1:

Example.1 - Scatter Plot in SAS

Example 2:

Example.2 - Scatter Plot in SAS

The PROC SGSCATTER Procedure

SAS PROC SGSCATTER helps to create different scatter plots in SAS. The syntax is:

PROC sgscatter  DATA=DATASET;
   PLOT VARIABLE_1 * VARIABLE_2
   / datalabel = VARIABLE group = VARIABLE;
RUN;

The SGSCATTER procedure creates a paneled graph of scatter plots for multiple combinations of a variable.

SAS Simple Scatter Plot

In this type of SAS Scatter plot, two variables are selected and are grouped with respect to a third variable.

Example:

proc sgplot data=mylib.employee;
 scatter x=salbegin y=salary / group=gender;
run;

 

SAS Simple Scatter Plot

SAS Scatter Plot with Prediction Ellipse

An ellipse approximates a region that contains 95% of the population. By default, the ellipse statement creates a prediction ellipse. The ellipse acts as an estimation parameter to predict the strength of correlation between the two variables.

Example:

proc sgplot data=sashelp.iris; 
title "Iris Petal Dimensions"; 
scatter x=petallength y=petalwidth;
ellipse x=petallength y=petalwidth; 
run;

    

Scatter Plot with Prediction Ellipse in SAS

Scatter Matrix in SAS

SAS Scatter Matrix consists of several pairwise scatter plots that are presented in the form of a matrix. The matrix tells us the correlation between different variables and whether they are positive or negative. They help us roughly determine if there is a correlation between multiple variables.

Example-

proc sgscatter data=mylib.employee;
where jobcat=1;
matrix salbegin salary jobtime prevexp / group=gender diagonal=(histogram kernel);
 run;

 

Scatter Matrix in SASSummary

I hope now you are clear with the concept of scatter plot in SAS, how can we create a SAS scatter plot and what are the different kinds of scatter plots in SAS that can be used to represent our data.

Stay tuned for more interesting topics and for any queries post your doubts in the comments section below.

You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

courses

DataFlair Team

The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.

1 Response

  1. Milind Hali says:

    What is the analysis of the scatter plot

Leave a Reply

Your email address will not be published. Required fields are marked *