Help using Base SAS procedures

Can someone help me with create a new balance ?

Accepted Solution Solved
Reply
Contributor
Posts: 36
Accepted Solution

Can someone help me with create a new balance ?


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!!


Accepted Solutions
Solution
‎12-19-2012 11:16 AM
Respected Advisor
Posts: 3,124

Re: Can someone help me with create a new balance ?

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


All Replies
Respected Advisor
Posts: 3,124

Re: Can someone help me with create a new balance ?

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

Super Contributor
Posts: 1,636

Re: Can someone help me with create a new balance ?

Haikuo,

Where is  the Keyword?

Solution
‎12-19-2012 11:16 AM
Respected Advisor
Posts: 3,124

Re: Can someone help me with create a new balance ?

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

Contributor
Posts: 36

Re: Can someone help me with create a new balance ?

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

Respected Advisor
Posts: 3,124

Re: Can someone help me with create a new balance ?

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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