Published on :
Statistics CREATION_INTERNE

Elementary Statistical Calculations on Internal Data

This code is also available in: Deutsch Español Français
Awaiting validation
This program initializes a SAS© table named 'dummy' with numeric values entered via the CARDS statement. It then performs a series of statistical calculations (maximum, minimum, sum, median, mean, square root) on these variables within a DATA step, before printing the results.
Data Analysis

Type : CREATION_INTERNE


Data is generated directly in the code using the 'cards' statement.

1 Code Block
DATA STEP Data
Explanation :
Creation of the 'dummy' table. The 'input' statement reads 5 variables. Raw data is provided line by line, and SAS continues reading on subsequent lines to complete an observation.
Copied!
1DATA dummy;
2INPUT X1 X2 X3 X4 X5;
3CARDS;
421
542
613
710
829
9;
10RUN;
2 Code Block
DATA STEP Data
Explanation :
Transformation step: reading the 'dummy' table and creating new variables containing descriptive statistics (Max, Min, Sum, Median, Mean, Square root) calculated horizontally across variables X1 to X5.
Copied!
1DATA dummy;
2SET dummy;
3max = max(X1,X2,X3,X4,X5);
4min = min(X1,X2,X3,X4,X5);
5sum = sum(X1,X2,X3,X4,X5);
6median = median(X1,X2,X3,X4,X5);
7mean = mean(X1,X2,X3,X4,X5);
8sqrt = sqrt(sum(X1,X2,X3,X4,X5));
9RUN;
3 Code Block
PROC PRINT
Explanation :
Displaying the resulting 'dummy' dataset in standard output.
Copied!
1PROC PRINT DATA= dummy;
2RUN;
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.