|
Chapter Contents |
Previous |
Next |
| Language Reference |
For example, suppose that you want to choose between x and y according to whether x#y is odd or even, respectively. The statements
x={1, 2, 3, 4, 5};
y={101, 205, 133, 806, 500};
r=choose(mod(x#y,2)=1,x,y);
print x y r;
result in
X Y R
1 101 1
2 205 205
3 133 3
4 806 806
5 500 500
Suppose you want all missing values in x to be changed to zeros.
Submit the following statements to produce the result shown below:
x={1 2 ., 100 . -90, . 5 8};
print x;
X 3 rows 3 cols (numeric)
1 2 .
100 . -90
. 5 8
The following statement replaces the
missing values in X with zeros:
x=choose(x=.,0,x);
print x;
X 3 rows 3 cols (numeric)
1 2 0
100 0 -90
0 5 8
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.