BookmarkSubscribeRSS Feed
Konkordanz
Pyrite | Level 9

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!

3 REPLIES 3
PaigeMiller
Diamond | Level 26

@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?

--
Paige Miller
Konkordanz
Pyrite | Level 9

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?

 

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

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
  • 3 replies
  • 217 views
  • 0 likes
  • 2 in conversation