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?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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