| Type | Quantity | Price | Cost |
| Buy | 100 | $1.20 | $120.00 |
| Buy | 50 | $1.60 | $80.00 |
| Sell | (120) | ($152.00) | |
| Sell | (12) | ($19.20) | |
| Buy | 15 | $1.10 | $16.50 |
| Buy | 40 | $1.20 | $48.00 |
| Sell | (70) | ($89.70) | |
| Buy | 50 | $1.15 | $57.50 |
| Sell | (30) | ($34.65) | |
| Sell | (10) | ($11.50) |

pobel 发表于 2013-1-27 16:21
data test;
infile cards missover;
input Type $ Quantity Price : dollar12.2 Cost : dollar ...
| id | Type | Quantity | Price |
1 | Buy | 100 | $1.20 |
1 | Buy | 50 | $1.60 |
1 | Sell | (120) | |
1 | Sell | (12) | |
1 | Buy | 15 | $1.10 |
1 | Buy | 40 | $1.20 |
1 | Sell | (70) | |
1 | Buy | 50 | $1.15 |
1 | Sell | (30) | |
1 | Sell | (10) | |
2 | Buy | 100 | $1.20 |
2 | Sell | (70) | |
2 | Buy | 50 | $1.15 |
2 | Sell | (30) | |
2 | Sell | (10) |
tangliang0905 发表于 2013-1-28 11:00
想到如果是LIFO的方法就会比较复杂一点,
LIFO是LAST IN FIRST OUT, 就这个例子来说,第三个观测120个se ...
pobel 发表于 2013-1-28 11:44
data test;
infile cards missover;
input id $ Type $ Quantity Price : dollar12.2 Cost ...
pobel 发表于 2013-1-29 08:25
你可以参考以下几篇关于hash的文章:
http://www2.sas.com/proceedings/forum2008/029-2008.pdf
扫码加好友,拉您进群



收藏
