I am working on a bond project. Sometimes bond is called, I need to create a new bond face value for each year after being called. Below is a simple table:
Year | BondFV | Called | newFV |
---|---|---|---|
1 | 100 | 0 | 100 |
2 | 100 | 5 | 95 |
3 | 100 | 0 | 95 |
4 | 100 | 0 | 95 |
5 | 100 | 4 | 91 |
6 | 100 | 0 | 91 |
How can I create the last colume? (new FV)
Any help would be greatly appreciated!!
Keyword of 'remain' is implied by using sum statement. Of course you can use it explicitly such as:
retain newfv;
Sorry for the confusion.
Haikuo
Keyword: retain.
data have;
input Year BondFV Called ;
cards;
1 100 0
2 100 5
3 100 0
4 100 0
5 100 4
6 100 0
;
data want;
set have;
if _n_=1 then newFV=bondfv;
newFV+(-called);
run;
Haikuo
Haikuo,
Where is the Keyword?
Keyword of 'remain' is implied by using sum statement. Of course you can use it explicitly such as:
retain newfv;
Sorry for the confusion.
Haikuo
Thank you , Hai.Kuo. But I realized my problem is more complicated than this. ( I should have enbe more specific). I forgot to add that my sample inludes many companies, and each company has several action_types ( not juste being called, sometime paying for sinking fund). so I need to use by ID, and action_type, : if first.ID and first.action_type , something like that. newFV-called-sinkinfund
But thank you , anyway. I am not sure if I have limitation of numbers of posting each day in this website? I may repost my question.
Anna
No limit on the number of posts. Go ahead post your new question , hopefully with new sample data, so people can work on it right away.
Regards,
Haikuo
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.