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

sas-innovate-2024.png

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.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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