Hi All, I want to calculate holding period of stocks to be held by a particular customer. For example look data in this format: TRANS_DATE STOCK SHRS Buy/Sell 1/30/2009 X 100 B 2/27/2009 X 100 B 3/31/2009 X 400 B 5/29/2009 X 100 B 11/16/2009 X 150 S 12/31/2009 X 190 S 1/11/2010 X 260 S Now ,150 units of 'X' were sold on 11/16/2009;out of which holding period of 100 is (11/16/2009-1/30/2009) and holding period of remaining 50 is (11/16/2009-2/27/2009). So I want output in this format: TRANS_DATE STOCK SHRS Buy/Sell Purchase date 1/30/2009 X 100 B 1/30/2009 2/27/2009 X 100 B 2/27/2009 3/31/2009 X 400 B 3/31/2009 5/29/2009 X 100 B 5/29/2009 11/16/2009 X 100 S 1/30/2009 11/16/2009 X 50 S 2/27/2009 12/31/2009 X 50 S 2/27/2009 12/31/2009 X 140 S 3/31/2009 1/11/2010 X 260 S 3/31/2009 Can anyone help me to build this logic in SAS? I guess we need to use Hash tables to store the data. Thanks & regards,
... View more