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!
data SALARY;
input EMPID $ SALARY JCLASS $;
if JCLASS = "1" then BONUS = 0.10*SALARY;
else if JCLASS = "2" then BONUS = 0.15*SALARY;
else if JCLASS = "3" then BONUS = 0.20*SALARY;
NEW_SALARY = BONUS + SALARY;
datalines;
137 28000 1
214 98000 3
199 150000 3
355 57000 2
;
1
DATA SALARY;
2
INPUT EMPID $ SALARY JCLASS $;
3
IF JCLASS = "1"THEN BONUS = 0.10*SALARY;
4
ELSEIF JCLASS = "2"THEN BONUS = 0.15*SALARY;
5
ELSEIF JCLASS = "3"THEN BONUS = 0.20*SALARY;
6
NEW_SALARY = BONUS + SALARY;
7
8
DATALINES;
9
137280001
10
214980003
11
1991500003
12
355570002
13
;
2 Code Block
PROC PRINT
Explanation : Simple display of the content of the newly created table in the results.
Copied!
proc print;
run;
1
PROC PRINT;
2
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.