Published on :
Data Manipulation CREATION_INTERNE

Using the MEAN function

This code is also available in: Deutsch Español Français
Awaiting validation
This script creates a SAS© table named 'ints'. It uses the INPUT statement to read four variables (ID, X1, X2, X3) from internally provided data (DATALINES). A new variable 'mu' is calculated for each observation containing the arithmetic mean of variables X1, X2, and X3.
Data Analysis

Type : CREATION_INTERNE


The data is generated by the script itself via the DATALINES statement.

1 Code Block
DATA STEP Data
Explanation :
Creation of the 'ints' table with calculation of the mean 'mu' for variables X1, X2, and X3 for each data row.
Copied!
1DATA ints;
2 INPUT ID X1 X2 X3;
3 mu = MEAN(X1, X2, X3);
4 DATALINES;
51 22 23 24
62 20 90 29
73 39 12 12
84 93 10 91
9;
10RUN;
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.