Hi,
with the proc-report-command i´m able to summarize groups with the break-command. But with this command it creates new summarized lines for all groups (for exampe: 4 groups). But what, if I want this summarized rows only for 1 of them? Is this doable? Something like..."summarize all values of row 1-4 and write it in row 5"...
Thank you!
@Konkordanz wrote:
Hi,
with the proc-report-command i´m able to summarize groups with the break-command. But with this command it creates new summarized lines for all groups (for exampe: 4 groups). But what, if I want this summarized rows only for 1 of them? Is this doable? Something like..."summarize all values of row 1-4 and write it in row 5"...
Sorry but I'm not grasping how what you are asking for is different than the break command. Can you please show us a small example, or explain in more detail?
Sorry for the lack of explanation. For example, here the have-dataset:
Size | bev |
2 | 10 |
3 | 20 |
10 | 30 |
11 | 40 |
12 | 60 |
13 | 50 |
14 | 40 |
15 | 30 |
16 | 90 |
33_34 | 30 |
40_41 | 20 |
No I want two new rows.
Row 1: This one should appear before Size 2 with the sum of Size 2 and 3.
Row 2: This one should appear before Size 10 with the sum of size 10-16.
The result is want:
Size | bev |
newLine1 | 30 |
2 | 10 |
3 | 20 |
newLine2 | 340 |
10 | 30 |
11 | 40 |
12 | 60 |
13 | 50 |
14 | 40 |
15 | 30 |
16 | 90 |
33_34 | 30 |
40_41 | 20 |
So: I need the rows only for Size = 2,3 and Size=10,11,12,13,14,15,16. The size 33_34 and 40_41 shouldnt get a line.
My question is: Is it within the proc-report-command doable?
I am not grasping how the programmer knows which records bet summed together into a group, and which records not to sum, what is the rule?
If you want sums ABOVE the rows with the data, you would have to create a data set somehow with everything in the right order including sums above the data to be summed, and then use PROC REPORT on that.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.