Published on :
Statistical CREATION_INTERNE

Example 1 for the EFFECTPLOT Statement

This code is also available in: Deutsch Español Français
Awaiting validation
This script reproduces Example 1 from the SAS©/STAT documentation for the EFFECTPLOT statement. It analyzes experimental data (Frankel, 1961) aimed at maximizing mercaptobenzothiazole (MBT) yield as a function of time and temperature. The code uses PROC ORTHOREG to fit a response surface model and generates several types of plots (global fit, slice views, and 'jittered' observations) to visualize the relationships between variables.
Data Analysis

Type : CREATION_INTERNE


The data is defined directly in the script via the DATA step 'd' and the DATALINES statement. It contains 3 numerical variables: Time, Temp, and MBT.

1 Code Block
DATA STEP Data
Explanation :
Creation of the dataset 'd' containing the experimental results. The use of ' @@' in the INPUT statement allows reading multiple observations on the same data line.
Copied!
1DATA d;
2 INPUT Time Temp MBT @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;
3 label Time = "Reaction Time (Hours)"
4 Temp = "Temperature (Degrees Centigrade)"
5 MBT = "Percent Yield Mercaptobenzothiazole";
6 DATALINES;
7 4.0 250 83.8 20.0 250 81.7 12.0 250 82.4
812.0 250 82.9 12.0 220 84.7 12.0 280 57.9
912.0 250 81.2 6.3 229 81.3 6.3 271 83.1
1017.7 229 85.3 17.7 271 72.7 4.0 250 82.0
11;
2 Code Block
PROC ORTHOREG
Explanation :
Fitting the regression model with PROC ORTHOREG. The EFFECTPLOT FIT statement generates a plot of the model fit with 'Time' on the X-axis, separated by 'Temp'.
Copied!
1ods graphics on;
2PROC ORTHOREG DATA=d;
3 model MBT=Time|Time|Temp|Temp;
4 effectplot fit(x=time plotby=temp);
5RUN;
3 Code Block
PROC ORTHOREG
Explanation :
Second identical fit, but using EFFECTPLOT SLICEFIT to display fit curves for specific values (slices) of the 'Temp' variable (229, 250, 271, 280).
Copied!
1PROC ORTHOREG DATA=d;
2 model MBT=Time|Time|Temp|Temp;
3 effectplot slicefit(x=time sliceby=temp=229 250 271 280);
4RUN;
4 Code Block
PROC ORTHOREG
Explanation :
Third adjustment using default EFFECTPLOT but with the OBS(JITTER) option to display actual observations overlaid with slight random noise (jitter) to avoid visual overlap.
Copied!
1PROC ORTHOREG DATA=d;
2 model MBT=Time|Time|Temp|Temp;
3 effectplot / obs(jitter(seed=39393));
4RUN;
5ods graphics off;
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.
Copyright Info : Frankel (1961) ... From Myers, Response Surface Methodology 1976.