Using the Value of a Third Variable as the Plotting Symbol - SAS Programming

Another form of the PLOT statement is:

PLOT y_variable*x_variable=plotting_variable;

Using this form of the PLOT statement permits you to use the value of the plotting variable for each observation as the plotting symbol.This variable can be either a character or numeric variable in your data set.The procedure uses the first character of a character variable, or the first digit of a numeric variable, as the plotting symbol.To demonstrate this, plot DBP by SBP with the values of DRUGGRP (drug group) as the plotting symbol:

Example

PROC PLOT DATA=CLIN_2;
TITLE 'Scatter Plot of SBP by DBP with'?
TITLE2 'Drug Group as the Plotting Symbol';
PLOT DBP*SBP=DRUGGRP;
RUN;

This produces:

Output from Example - Using the Value of a Third Variable as the Plotting Symbol

Output from Example - Using the Value of a Third Variable as the Plotting Symbol

Again, as with the case where you supplied the plotting symbol, the location of multiple observations is lost, but you do know how many observations are not displayed.Note the difference between the two forms of the PLOT statement:

1. PLOT y_variable * x_variable = 'plotting symbol';
and
2. PLOT y_variable * x_variable = plotting_variable;

In the latter case there are no quotation marks around the plotting variable.It is this distinction by which the procedure knows whether you are specifying a plotting symbol or a variable whose value is to be used as the plotting symbol.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

SAS Programming Topics