Syntax, ID statement
in the PRINT procedure:
ID variable(s);
|
proc print data=sasuser.reps; id idnum lastname; run;
proc print data=sasuser.reps; id idnum lastname; var idnum sex jobcode salary; run;
Syntax, WHERE statement:
WHERE where-expression;
|
proc print data=clinic.admit;
var age height weight fee;
where age>30;
run;
Symbol
|
Meaning
|
Sample Program Code
|
---|---|---|
= or eq
|
equal to
|
where name='Jones, C.'; |
^= or ne
|
not equal to
|
where temp ne 212; |
> or gt
|
greater than
|
where income>20000; |
< or lt
|
less than
|
where partno lt "BG05"; |
>= or ge
|
greater than or equal
to
|
where id>='1543'; |
<= or le
|
less than or equal to
|
where pulse le 85; |
?
.
You can use either the CONTAINS keyword or the symbol in your code,
as shown below. where firstname CONTAINS 'Jon'; where firstname ? 'Jon';
Operator, Symbol
|
Description
|
|
---|---|---|
AND
|
&
|
and, both. If both expressions
are true, then the compound expression is true.
|
OR
|
|
|
or, either. If either
expression is true, then the compound expression is true.
|
where age<=55 and pulse>75; where area='A' or region='S'; where ID>'1050' and state='NC';
where actlevel='LOW' or actlevel='MOD'; where fee=124.80 or fee=178.20;
where actlevel in ('LOW','MOD'); where fee in (124.80,178.20);
where (age<=55 and pulse>75) or area='A'; where age<=55 and (pulse>75 or area='A');