Published on :
Statistical CREATION_INTERNE

Calculation of statistical functions with DATA step

This code is also available in: Deutsch Español Français
Awaiting validation
The script starts with a DATA step to create a dataset named 'Stats'. Inside this DATA step, a 'DO' loop iterates over 'x' values ranging from -2 to 2 by steps of 1. For each 'x' value, it calculates the standard normal cumulative distribution function (CDF('NORM', x)) and a parameterized version of the normal cumulative distribution function (CDF('NORM', x, 1, 1), with mean 1 and standard deviation 1). Then, it applies the PROBIT function to the first calculated CDF value to obtain the inverse quantile value. Each row of results is added to the 'Stats' dataset. Finally, a PROC PRINT is used to display the content of the 'Stats' dataset with a specific title.
Data Analysis

Type : CREATION_INTERNE


The data is entirely generated within the SAS script via a DATA step using a DO loop and built-in statistical functions (CDF, PROBIT).

1 Code Block
DATA STEP Data
Explanation :
This DATA step block creates the 'Stats' dataset. It initializes an 'x' variable and iterates from -2 to 2. For each 'x', it calculates two values of the normal cumulative distribution function (F1 and F2) and the inverse quantile function (PROBIT) for F1. The OUTPUT command adds the row to the 'Stats' dataset at each iteration.
Copied!
1DATA Stats;
2 DO x = -2 TO 2 BY 1;
3 F1 = CDF('NORM', x);
4 F2 = CDF('NORM', x, 1, 1);
5 P = PROBIT(F1);
6 OUTPUT;
7 END;
8RUN;
2 Code Block
PROC PRINT
Explanation :
This block defines a title for the output and uses PROC PRINT to format and display the content of the previously created 'Stats' dataset, including columns x, F1, F2, and P.
Copied!
1TITLE "STATS";
2PROC PRINT DATA=Stats; RUN;
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.