BookmarkSubscribeRSS Feed
TMorville
Calcite | Level 5
Hi. I have a dataset that looks like this..

Name Value
X 13
X 12
Y 44
X 12
Y 213
Z 12
Y 54

But.. it's with approximatly 2000 different X,Y,Z....

So what i would like SAS to do, is to recognize each specific X, and everytime it does so, add the "Value" variable. X would in this test case be 13+12+12 = 27 - output would thus look like:

Name Value
X 27
Y 311
Z 12

I've tryed to google it, but with no luck.

Any ideas?

Thanks!
2 REPLIES 2
TMorville
Calcite | Level 5
I think i just made this work:


proc sql;
create table g as
select
by,
sum(VALUE) as branch_profit
from c
where by ne ' '
group by NAME;
quit; Message was edited by: TMorville
Peter_C
Rhodochrosite | Level 12
> Hi. I have a

> variable. X would in this test case be 13+12+12 = 27

challenging 😉


> Any ideas?


proc means
will also provide class totals like
proc means data= whatever nway ;
class name ;
var value ;
output sum= out= summary ;
run ;
proc print ;
id name ;
var value ;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 937 views
  • 0 likes
  • 2 in conversation