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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.