BookmarkSubscribeRSS Feed
SP01
Obsidian | Level 7

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  

GroupSum
A1
A3
A4
A1
A2
Total11


data b 

GroupSum
A5
A2
A3
A5
A5
Total20


expand the difference of 9 into rows 

GroupCount
A1
A1
A1
A1
A1
A1
A1
A1
A1


data want 

GroupSum
A1
A3
A4
A1
A2
Total11
A1
A1
A1
A1
A1
A1
A1
A1


SAS peeps, I really appreciate and thank you for your time and help on this.

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

A few things.

 

  1. Why?
  2. You seem to have only 8 obs appended to your original data? Is that an error?
  3. Are there always 2 data sets or could there be more? And are there more than 1 group in your data sets?

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 494 views
  • 0 likes
  • 2 in conversation