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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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