Published on :
Data Manipulation CREATION_INTERNE

Using the CEIL and FLOOR mathematical functions

This code is also available in: Deutsch Español Français
Awaiting validation
This script creates a SAS© table 'CEIL_DATA' by reading decimal values from internal data lines (datalines). It then calculates for each value the smallest integer greater than or equal to (CEIL) and the largest integer less than or equal to (FLOOR). The results are displayed using the PRINT procedure.
Data Analysis

Type : CREATION_INTERNE


Data is provided directly in the code via the DATALINES statement and read with the line-hold operator '@@'.

1 Code Block
DATA STEP Data
Explanation :
Creation of the 'CEIL_DATA' table. The 'input a @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;' statement continuously reads variables from the data lines. The 'ceil(a)' function returns the smallest integer greater than or equal to 'a', and 'floor(a)' returns the largest integer less than or equal to 'a'.
Copied!
1DATA CEIL_DATA;
2 INPUT a @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;
3 b=ceil(a);
4 c=floor(a);
5 DATALINES;
61.5 -2.4 3.1 -45.7 76.8 -33.9 86.2 -567.4 -34.6 342.3
7;
2 Code Block
PROC PRINT
Explanation :
Displays the content of the 'CEIL_DATA' table, showing the original value, its ceiling value (ceil) and its floor value (floor).
Copied!
1PROC PRINT DATA=CEIL_DATA;
2 var a b c;
3RUN;
4QUIT;
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.