BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Anna_Guo
Calcite | Level 5


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:

YearBondFVCallednewFV
1

100

0100
2100595
3100095
4100095
5100491
6100091

How can I create the last colume? (new FV)

Any help would be greatly appreciated!!

1 ACCEPTED SOLUTION

Accepted Solutions
Haikuo
Onyx | Level 15

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

View solution in original post

5 REPLIES 5
Haikuo
Onyx | Level 15

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

Linlin
Lapis Lazuli | Level 10

Haikuo,

Where is  the Keyword?

Haikuo
Onyx | Level 15

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

Anna_Guo
Calcite | Level 5

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

Haikuo
Onyx | Level 15

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

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2003 views
  • 4 likes
  • 3 in conversation