SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
gregor1
Quartz | Level 8

I have three columns which I want to use to get a sum.

It looks like this:

TEAM

Team Count

One Team's Share

1

61456

 

2

56788

 

3

25524

 

4

32256

 

5

78552

 

6

44796

 

7

38128

 

8

112586

 

9

1532

510.6666667

10

9560

3186.666667

11

616

205.3333333

12

31712

10570.66667

13

20528

6842.666667

14

17060

5686.666667

15

9956

 

 

 

For the new column:

I want the sum of the value for Team 3's Team Count & Team 11's One Team's Share value.  I want that sum to be in a fourth column and on the same row as Team 3.  I need a function that will accomplish similarly for each of the Teams 1 - 8 and 15.

 

Can anyone help me? Thank you!

2 REPLIES 2
TomKari
Onyx | Level 15

Is there a general, repeatable requirement for this, backed by a generalized description?

 

Because this sure looks like a job for Excel to me!

 

Tom

 

P.S. Yes, of course it can be done in SAS, but WHY??

Astounding
PROC Star

I guess I get to invent the variable names:

 

data want;

set have (where=(team=11) rename=(share=team11_share));

do until (done);

   set have end=done;

   if share=. then column4 = count + team11_share;

   else column4 = .;

   output;

end;

drop team11_share;

run;

 

EDITED to add missing statement.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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