Published on :
ETL CREATION_INTERNE

Bonus Calculation and New Salary by Classification

This code is also available in: Deutsch Español Français
Awaiting validation
This SAS© program initializes a data table named 'SALARY' from static data (datalines). It calculates a bonus proportional to the salary (10%, 15%, or 20%) based on the value of the 'JCLASS' variable and determines the final salary 'NEW_SALARY'. The result is displayed using the PRINT procedure.
Data Analysis

Type : CREATION_INTERNE


The data is directly integrated into the source code via the DATALINES instruction.

1 Code Block
DATA STEP Data
Explanation :
Creation of the SALARY table. Reading variables, applying IF/ELSE conditions to determine the bonus rate, and calculating the new salary.
Copied!
1DATA SALARY;
2 INPUT EMPID $ SALARY JCLASS $;
3IF JCLASS = "1" THEN BONUS = 0.10*SALARY;
4ELSE IF JCLASS = "2" THEN BONUS = 0.15*SALARY;
5ELSE IF JCLASS = "3" THEN BONUS = 0.20*SALARY;
6NEW_SALARY = BONUS + SALARY;
7 
8DATALINES;
9137 28000 1
10214 98000 3
11199 150000 3
12355 57000 2
13;
2 Code Block
PROC PRINT
Explanation :
Simple display of the content of the newly created table in the results.
Copied!
1PROC PRINT;
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.