- Get link
- X
- Other Apps
ARTHEMATIC OPERATORS
--> IN SAS THERE ARE SOME ARTHEMATIC OPERATORS ..
ADDITION = +
SUBTRACT = -
MULTIPLICATION = *
DIVISION = /
HERE ARE SOME EXAMPLES:
ADDITION OPERATOR:
DATA A10;
SET SASUSER.CLASS2;
HT=HEIGHT+10;
KEEP NAME HEIGHT HT;
RUN;
PROC PRINT;
RUN;
LOG:
NOTE: There were 19 observations read from the data set SASUSER.CLASS2.
NOTE: The data set WORK.A10 has 19 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: There were 19 observations read from the data set WORK.A10.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.04 seconds
cpu time 0.01 seconds
RESULT:
Obs | Name | Height | HT |
---|---|---|---|
1 | Alfred | 69 | 79.0 |
2 | Alice | 56.5 | 66.5 |
3 | Barbara | 65.3 | 75.3 |
4 | Carol | 62.8 | 72.8 |
5 | Henry | 63.5 | 73.5 |
6 | James | 57.3 | 67.3 |
7 | Jane | 59.8 | 69.8 |
8 | Janet | 62.5 | 72.5 |
9 | Jeffrey | 62.5 | 72.5 |
10 | John | 59 | 69.0 |
11 | Joyce | 51.3 | 61.3 |
12 | Judy | 64.3 | 74.3 |
13 | Louise | 56.3 | 66.3 |
14 | Mary | 66.5 | 76.5 |
15 | Philip | 72 | 82.0 |
16 | Robert | 64.8 | 74.8 |
17 | Ronald | 67 | 77.0 |
18 | Thomas | 57.5 | 67.5 |
19 | William | 66.5 | 76.5 |
SUBTRACT OPERATOR:
DATA A11;
SET SASUSER.CLASS2;
AGEE=AGE-5;
KEEP NAME AGE AGEE;
RUN;
PROC PRINT;
RUN;
LOG:
NOTE: There were 19 observations read from the data set SASUSER.CLASS2.
NOTE: The data set WORK.A11 has 19 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: There were 19 observations read from the data set WORK.A11.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.04 seconds
cpu time 0.01 seconds
RESULT:
Obs | Name | Age | AGEE |
---|---|---|---|
1 | Alfred | 14 | 9 |
2 | Alice | 13 | 8 |
3 | Barbara | 13 | 8 |
4 | Carol | 14 | 9 |
5 | Henry | 14 | 9 |
6 | James | 12 | 7 |
7 | Jane | 12 | 7 |
8 | Janet | 15 | 10 |
9 | Jeffrey | 13 | 8 |
10 | John | 12 | 7 |
11 | Joyce | 11 | 6 |
12 | Judy | 14 | 9 |
13 | Louise | 12 | 7 |
14 | Mary | 15 | 10 |
15 | Philip | 16 | 11 |
16 | Robert | 12 | 7 |
17 | Ronald | 15 | 10 |
18 | Thomas | 11 | 6 |
19 | William | 15 | 10 |
MULTIPLY AND DIVISION OPERATOR:
DATA A12;
SET SASUSER.CLASS2;
AGEE=AGE*2;
CLASSS=CLASS/2;
KEEP NAME AGE AGEE CLASS CLASSS;
RUN;
PROC PRINT;
RUN;
LOG:
NOTE: There were 19 observations read from the data set SASUSER.CLASS2.
NOTE: The data set WORK.A12 has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: There were 19 observations read from the data set WORK.A12.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.09 seconds
cpu time 0.00 seconds
RESULT:
Obs | Name | Age | CLASS | AGEE | CLASSS |
---|---|---|---|---|---|
1 | Alfred | 14 | 9 | 28 | 4.5 |
2 | Alice | 13 | 8 | 26 | 4.0 |
3 | Barbara | 13 | 8 | 26 | 4.0 |
4 | Carol | 14 | 9 | 28 | 4.5 |
5 | Henry | 14 | 9 | 28 | 4.5 |
6 | James | 12 | 7 | 24 | 3.5 |
7 | Jane | 12 | 7 | 24 | 3.5 |
8 | Janet | 15 | 10 | 30 | 5.0 |
9 | Jeffrey | 13 | 8 | 26 | 4.0 |
10 | John | 12 | 7 | 24 | 3.5 |
11 | Joyce | 11 | 6 | 22 | 3.0 |
12 | Judy | 14 | 9 | 28 | 4.5 |
13 | Louise | 12 | 7 | 24 | 3.5 |
14 | Mary | 15 | 10 | 30 | 5.0 |
15 | Philip | 16 | 11 | 32 | 5.5 |
16 | Robert | 12 | 7 | 24 | 3.5 |
17 | Ronald | 15 | 10 | 30 | 5.0 |
18 | Thomas | 11 | 6 | 22 | 3.0 |
19 | William | 15 | 10 | 30 | 5.0 |
--PLEASE FOLLOW THE BLOG FOR MORE UPDATES...
--FOLLOW US IN FACEBOOK SASALL4YOU AND JOIN ...
--JOIN US IN FACEBOOK AND TELEGRAM CHANNEL FOR MORE UPDATES
CLICK HERE: https://t.me/SasAll4You
- Get link
- X
- Other Apps
Comments
Post a Comment