Hello SAS community,
I have a problem where I would appreciate your time and help.
Let's say I have data A with group ID 'A' and the total sum of the group ID 'A' is 11. I have another data B with the same group ID 'A' and the total sum of the group ID 'A' is 20. Now the difference is 9, I want to expand this difference of 9 into 9 rows by that group ID 'A' and /append/insert into data A. I have put the tables for your reference.
data A
| Group | Sum |
| A | 1 |
| A | 3 |
| A | 4 |
| A | 1 |
| A | 2 |
| Total | 11 |
data b
| Group | Sum |
| A | 5 |
| A | 2 |
| A | 3 |
| A | 5 |
| A | 5 |
| Total | 20 |
expand the difference of 9 into rows
| Group | Count |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
data want
| Group | Sum |
| A | 1 |
| A | 3 |
| A | 4 |
| A | 1 |
| A | 2 |
| Total | 11 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
| A | 1 |
SAS peeps, I really appreciate and thank you for your time and help on this.
A few things.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.