turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Code involving an incremental value (100 times)

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-22-2017 12:10 PM - edited 09-22-2017 12:20 PM

Hello dear experts,

I am facing a challenge today: need to find a sum of payments for groups of subjets ('Name' in the table below) that fall within assets ranges:

name | assets | payment |

A | 100,400 | 456 |

B | 300,500 | 1344 |

C | 100,800 | 357 |

D | 1,800,000 | 7348 |

E | 300,003 | 467 |

F | 340,000 | 966 |

G | 15,000,900 | 34533 |

H | 785,004,000 | 7238 |

The ranges start from 100,000 and increment every 100,000 until 10,000,000. Whatever is greater than 10,000,000 is grouped together. So, there are 100 assets ranges:

100,001-200,000

200,001-300,000

...

1,900,001-2,000,000

2,000,001-2,100,000

...

10,000,000 and over

For example, payment for A and C will be summarized together. Same goes with B, E, and F. Also G and H.

I know it should be a loop with an incremental value to calculate sum of payments for each asset range but I can't figure it out. Need your help please!

Thanks

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-22-2017 12:18 PM

DiG wrote:

I know it should be a loop with an incremental value to calculate sum of payments for each range but I can't figure it out. Need your help please!

I'm not sure what that means, but a SAS way of doing this easily is:

1. Create a format that contains your intervals.

2. Apply the format using a PUT statement to identify your groups.

3. Then sum using PROC MEANS.

Example for #1

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

09-22-2017 01:27 PM

Thank you Reeza