series rise drop
1 1
2 -1
3 1 -1
4 1
5 1 -1
6 1
7 1
8 -1
9 -1
10
11 1
12
13
14 1
15 1
16 1 -1
17 1
18 1
19 -1
20
21 1
22 1 -1
23 -1
24 -1
25 1
期望结果:
series | rise | drop | sum |
1 | 1 | 1 | |
2 | -1 | -1 | |
3 | 1 | -1 | 2 |
4 | 1 | 1 | |
5 | 1 | -1 | 2 |
6 | 1 | 1 | |
7 | 1 | 1 | |
8 | -1 | -1 | |
9 | -1 | -1 | |
10 | 0 | ||
11 | 1 | 1 | |
12 | 0 | ||
13 | 0 | ||
14 | 1 | 1 | |
15 | 1 | 1 | |
16 | 1 | -1 | 2 |
17 | 1 | 1 | |
18 | 1 | 1 | |
19 | -1 | -1 | |
20 | 0 | ||
21 | 1 | 1 | |
22 | 1 | -1 | 2 |
23 | -1 | -1 | |
24 | -1 | -1 | |
25 | 1 | 1 |
新生成sum列
若rise列与drop列都不是空格,则sum返回2。
若rise列或drop列任意1列为空格,则sum=rise+drop。
用SAS实现