sex=femaleand the WHERE clause condition in SAS translates into
position=marketingthe resulting selection criteria are
sex=female and position=marketing
*sasand* department=marketingand execute a SAS procedure that includes a WHERE clause that produces the following condition:
salary gt 1000The resulting selection criteria are
salary gt 1000 and department=marketing
proc print data=vlib.emp1; where lastname < 'KAP' and payrate > 30 * overtime; run;the interface view engine translates as much of the WHERE clause as possible, without producing incorrect results or a syntax error in SYSTEM 2000. In this example, SYSTEM 2000 can execute the first condition, but the arithmetic in the second condition is not supported. Therefore, the engine uses
where lastname
< 'KAP'
to filter out as many data records as possible
to improve performance. The conditions that are not supported are
bypassed by the engine, and post-processing (performed automatically
by SAS) will be required after SYSTEM 2000 completes its subsetting.
The engine bypasses:
where-clause in SYSTEM 2000 View Descriptor
|
WHERE Clause in
SAS
|
SYSTEM 2000 Translation
|
Post-Processing Required?
|
---|---|---|---|
C1=A
|
C2=B OR C3>C4+10
|
(C1=A)
|
Yes
|
C1=A
|
C2=B & C3>C4+10
|
(C1=A) & (C2=B)
|
Yes
|
C1=A
|
C2=B OR C3>C4
|
(C1=A) & (C2=B OR
C3*>C4*)
|
No
|
C1=A
|
C2=B & C3
|
(C1=A) & (C2=B)
|
Yes
|
---
|
---
|
C114 EXISTS OR C114
FAILS
|
No
|
---
|
C3*20 < C5
|
C114 EXISTS OR C114
FAILS
|
Yes
|
---
|
C3 = C5
|
C3* = C5*
|
No
|
WHERE Clause Operators
in SAS
|
SYSTEM 2000 Operators
|
---|---|
=
|
=
|
>
|
>
|
<
|
<
|
<>
|
!=
|
>=
|
>=
|
<=
|
<=
|
IS NULL
|
FAILS
|
IS NOT NULL
|
EXISTS
|
(
|
(
|
)
|
)
|
AND
|
AND
|
OR
|
OR
|
WHERE Clause Syntax
in SAS
|
SYSTEM 2000 Translation
|
---|---|
C1 BETWEEN 1 AND 3
|
C1 = 1*3
|
C1 IN (4,9,14)
|
C1=4 OR C1=9 OR C1=14
|
C4 > C5
|
C4* > C5*
|
C4 = '02AUG87'D
|
C4 = 08/02/1987
|
WHERE Clause Syntax
in SAS
|
SYSTEM 2000 Translation
|
---|---|
C1 LIKE %ABC%
|
C1 CONTAINS ABC
|
C1 LIKE ABC%
|
C1 CONTAINS ABC IN 1
|
C1 LIKE _ABC%
|
C1 CONTAINS ABC IN 2
|
C1 LIKE __ABC%
|
C1 CONTAINS ABC IN 3
|
WHERE C1 = C4 * 3 WHERE C4 < -C5
WHERE C1 WHERE (C1 = C2) * 20
C1 =: ABC
'12:00'T '01JAN60:12:00'DT
WHERE C1 IS NULL
,
do not use WHERE C1 = .
or ''
to indicate a null. The interface view engine can translate C1 IS NULL into C1 FAILS.
WHERE Clause in SAS
|
What the Interface View
Engine Sees
|
---|---|
WH NOT LASTNAME = 'Jones';
|
WH LASTNAME NE 'Jones';
|
WH NOT LASTNAME > 'Baker';
|
WH LASTNAME <= 'Baker';
|
WH NOT (LASTNAME = JONES
AND HIREDATE > '02aug82'd);
|
WH LASTNAME NE 'Jones'
OR HIREDATE <= '02aug82'd;
|
wh not lastname = 'Jones';
is wh
lastname ne Jones or lastname fails
. Before any relational
operator can find a match for a value, the value must exist. One reason
for this is that nulls are not contained in SYSTEM 2000 indexes, and
processing an operator such as NE could be expensive if it were not
confined to indexed values.