Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- Increment a cost by 5% for 4 series

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 10-02-2014 02:32 PM
(1044 views)

What is the best way (formula only) to show an increment by 5%. So for example cost = 23, what is the best formaula to use to also show 4 increments by 5%. So cost1 = cost + cost * 0.05 and cost2 = cost + cost*0.1 .. etc... Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

data have;

array c{*} cost1-cost4;

cost=23;

do i=1 to 4;

p+0.05;

c{i}=cost*(1+p);

end;

run;

8 REPLIES 8

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

math 101

cost(1)= cost(1.04)

cost(2)=cost(1.04)*(1.04)

cost(3)=cost(1.04)*(1.04)*(1.04)

..

cost(n)=cost(1.04)**n

These can also vary slightly depending on when increases are, extra payments and all sorts of variations.

Anyways, there's a whole scheme of SAS finance functions that accomplishes these:

SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

EDIT: I assumed a 4% increase for some reason, you can replace that with the relevant amount.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Yes, but I was hoping to see it in a loop.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

A formula is a part of one assignment with one result.

To get 4 answers you need 4 assignnents

Except for a CALL routine like CALL SCAN which derives 3 results in one statement. But to write your own call routine involves more than one statement.

So, what does your request mean.

Cost1 = cost * ( 1+ rate/100) ;

Cost2 = cost1*( 1+ rate/100) ;

Cost3 = cost2*( 1+ rate/100) ;

where rate is 5 for 5%

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

then what does your data look like and what do you want the output to look like?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I am trying to see losses based on different cost scenarios so part of a larger formula , cost would be shoiwng as cost1, cost2, cost3, etc..

for example Losses = cost + fees + interest. I want to see the Losses scenarios if Cost incremented by 5% .. and I want to see it for 4 scenarios.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I don't understand

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

data have;

array c{*} cost1-cost4;

cost=23;

do i=1 to 4;

p+0.05;

c{i}=cost*(1+p);

end;

run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you ..

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

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.