- Get link
- X
- Other Apps
LOGICAL OPERATORS
--> IN SAS THERE ARE SOME LOGICAL OPERATORS TO SUBSET THE VARIABLES..
(AND,OR,NOT) ARE THE LOGICAL OPERATORS ..
OR OPERATOR:
DATA A13;
SET SASUSER.CLASS2;
WHERE AGE=12 OR CLASS=7;
RUN;
PROC PRINT;
RUN;
LOG:
NOTE: There were 5 observations read from the data set SASUSER.CLASS2.
WHERE (AGE=12) or (CLASS=7);
NOTE: The data set WORK.A13 has 5 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.54 seconds
cpu time 0.06 seconds
NOTE: Writing HTML Body file: sashtml.htm
NOTE: There were 5 observations read from the data set WORK.A13.
NOTE: PROCEDURE PRINT used (Total process time):
real time 1.56 seconds
cpu time 0.28 seconds
RESULT:
Obs | Name | Sex | Age | Height | Weight | DOB | CLASS |
---|---|---|---|---|---|---|---|
1 | James | M | 12 | 57.3 | 83 | 15/03/2011 | 7 |
2 | Jane | F | 12 | 59.8 | 84.5 | 17/04/2011 | 7 |
3 | John | M | 12 | 59 | 99.5 | 15/06/2011 | 7 |
4 | Louise | F | 12 | 56.3 | 77 | 14/11/2011 | 7 |
5 | Robert | M | 12 | 64.8 | 128 | 14/12/2011 | 7 |
AND OPERATOR:
DATA A14;
SET SASUSER.CLASS2;
WHERE SEX='M' AND CLASS=9;
RUN;
PROC PRINT;
RUN;
LOG:
NOTE: There were 2 observations read from the data set SASUSER.CLASS2.
WHERE (SEX='M') and (CLASS=9);
NOTE: The data set WORK.A14 has 2 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: There were 2 observations read from the data set WORK.A14.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.09 seconds
cpu time 0.00 seconds
RESULT:
Obs | Name | Sex | Age | Height | Weight | DOB | CLASS |
---|---|---|---|---|---|---|---|
1 | Alfred | M | 14 | 69 | 112.5 | 12/10/2009 | 9 |
2 | Henry | M | 14 | 63.5 | 102.5 | 14/11/2009 | 9 |
NOT OPERATOR:
DATA A15;
SET SASUSER.CLASS2;
WHERE SEX NOT IN('F');
RUN;
PROC PRINT;
RUN;
LOG:
NOTE: There were 10 observations read from the data set SASUSER.CLASS2.
WHERE SEX not = 'F';
NOTE: The data set WORK.A15 has 10 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: There were 10 observations read from the data set WORK.A15.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.06 seconds
cpu time 0.00 seconds
RESULT:
Obs | Name | Sex | Age | Height | Weight | DOB | CLASS |
---|---|---|---|---|---|---|---|
1 | Alfred | M | 14 | 69 | 112.5 | 12/10/2009 | 9 |
2 | Henry | M | 14 | 63.5 | 102.5 | 14/11/2009 | 9 |
3 | James | M | 12 | 57.3 | 83 | 15/03/2011 | 7 |
4 | Jeffrey | M | 13 | 62.5 | 84 | 15/04/2010 | 8 |
5 | John | M | 12 | 59 | 99.5 | 15/06/2011 | 7 |
6 | Philip | M | 16 | 72 | 150 | 16/04/2008 | 11 |
7 | Robert | M | 12 | 64.8 | 128 | 14/12/2011 | 7 |
8 | Ronald | M | 15 | 67 | 133 | 12/03/2009 | 10 |
9 | Thomas | M | 11 | 57.5 | 85 | 14/05/2012 | 6 |
10 | William | M | 15 | 66.5 | 112 | 15/02/2009 | 10 |
--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