我想計算adjusted_volume變量,如下所示;如何使用SAS計算分部?
+------+------+---------------+-------------+-----------------+
| name | date | CountedVOLUME | DailyVolume | adjusted_volume |
+------+------+---------------+-------------+-----------------+
| A | 1 | 10 | | |
| A | 1 | 11 | 21 | |
| A | 2 | 12 | | |
| A | 2 | 13 | | |
| A | 2 | 14 | 39 | |
| A | 3 | 15 | 15 | |
| A | 4 | 16 | 16 | |
| A | 5 | 17 | | |
| A | 5 | 18 | | |
| A | 5 | 19 | | |
| A | 5 | 20 | 74 | |
| A | 6 | 21 | 0.127272727 | |
| A | 6 | 22 | 43 | 0.133333333 |
| B | 1 | 10 | | |
| B | 1 | 11 | 21 | |
| B | 2 | 12 | | |
| B | 2 | 13 | | |
| B | 2 | 14 | 39 | |
| B | 3 | 15 | 15 | |
| B | 4 | 16 | 16 | |
| B | 5 | 17 | | |
| B | 5 | 18 | | |
| B | 5 | 19 | | |
| B | 5 | 20 | 74 | |
| B | 6 | 21 | 0.127272727 | |
| B | 6 | 22 | 43 | 0.133333333 |
+------+------+---------------+-------------+-----------------+
Adjusted_volume = CountedVOLUME /(在求和前五天DailyVolumes的)
我使用相同的編號爲A和B只是爲了簡單起見。
我該怎麼做?
https://stackoverflow.com/help/how-to-ask – Reeza