BookmarkSubscribeRSS Feed
-a_a-rlis
Calcite | Level 5

I have a dataset like below:

 

Finality        Balance

a                    10

b                    15

c                     8

d                    30

 

First, I would like to sum the finalities 'a' and 'd', resulting in 40. Then, this result must be divided by the sum of all rows. Is there a way to do so, since I have to do the same thing for b and c, separately (dividing 'b' by the sum of all rows and so on)?

The final table I need is something like:

Finality        Result

e (a+d)         0.6349

b                  0.2381

c                  0.1270

 

I don't know if I made myself clear. Sorry if don't.

4 REPLIES 4
ballardw
Super User

If you only have four rows then do this by hand.

 

If you have lots more rows then more complete example data and the RULES, not the rows, but how do we know that A and D rows are the ones to add, as well as the B and C? There is not immediately obvious surface logic that says these specific pairs should be added.

novinosrin
Tourmaline | Level 20

"If you only have four rows then do this by hand."---

 

Sir @ballardw  Not really participating in this thread or much today as I am not feeling well, but that comment made me laugh. I didn't know you had a sense of humor. Nice to notice that. 🙂

ballardw
Super User

@novinosrin 

Hope feel better soon.

 

Some have considered my humor odd at times.

In this case I am actually moderately serious with the number of missing elements of the problem description.

Reeza
Super User

Use a custom format, along with PROC FREQ.

 

proc format;
value final_fmt
'a', 'd' = ' e (a+d)'
other = [$8.];
run;

proc freq data=have;
table finality / out=want outpct;
format finality final_fmt.;
run;

@-a_a-rlis wrote:

I have a dataset like below:

 

Finality        Balance

a                    10

b                    15

c                     8

d                    30

 

First, I would like to sum the finalities 'a' and 'd', resulting in 40. Then, this result must be divided by the sum of all rows. Is there a way to do so, since I have to do the same thing for b and c, separately (dividing 'b' by the sum of all rows and so on)?

The final table I need is something like:

Finality        Result

e (a+d)         0.6349

b                  0.2381

c                  0.1270

 

I don't know if I made myself clear. Sorry if don't.


 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 4 replies
  • 892 views
  • 2 likes
  • 4 in conversation