![]() Chapter Contents |
![]() Previous |
![]() Next |
| SELECT |
| Valid: | in a DATA step |
| Category: | Control |
| Type: | Executable |
| Syntax | |
| Arguments | |
| Details | |
| Comparisons | |
| Examples | |
| Example 1: Using Statements | |
| Example 2: Using DO Groups | |
| Example 3: Using a Compound Expression | |
| Example 4: Making Comparisons for Equality | |
| See Also | |
Syntax |
SELECT <(select-expression)>;
|
| END; |
| Details |
| Comparisons |
| Examples |
select (a); when (1) x=x*10; when (2); when (3,4,5) x=x*100; otherwise; end;
select (payclass);
when ('monthly') amt=salary;
when ('hourly')
do;
amt=hrlywage*min(hrs,40);
if hrs>40 then put 'CHECK TIMECARD';
end; /* end of do */
otherwise put 'PROBLEM OBSERVATION';
end; /* end of select */
select;
when (mon in ('JUN', 'JUL', 'AUG')
and temp>70) put 'SUMMER ' mon=;
when (mon in ('MAR', 'APR', 'MAY'))
put 'SPRING ' mon=;
otherwise put 'FALL OR WINTER ' mon=;
end;
/* INCORRECT usage to select value of 2 */ select (x); /* evaluates T/F and compares for */ /* equality with x */ when (x=2) put 'two'; end; /* correct usage */ select(x); /* compares 2 to x for equality */ when (2) put 'two'; end; /* correct usage */ select; /* compares 2 to x for equality */ when (x=2) put 'two'; end;
| See Also |
Statements:
|
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.