Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Multiple Observations

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

Multiple Observations

Hi, EM newbie. I have a data set that has multiple observations. I want to consolidate the ID's and sum the corresponding Wire.

I have been attempting to do it by attaching a SAS Code node to my file import node and running a PROC Sort command. I will then want to merge this data with another file.

Is the PROC Sort command the right way to go, if so please help with syntax... or is there an easier way.

Thanks!

Seth

Original DataDesired Output
IDWireID Wire
181181
772778
77611014
11051161
11093780
11616671
3780
6671
667

Accepted Solutions
Solution
‎09-11-2013 03:30 PM
Super Contributor
Posts: 1,636

Re: Multiple Observations

or you could use proc summary:

proc summary data=in_data nway;

var wire;

class id;

output out=want(keep=id total)  sum=total;

run;

proc print data=want;run;

View solution in original post


All Replies
Super Contributor
Posts: 543

Re: Multiple Observations

How about this?

data in_data;

input ID    Wire    ;

cards;

18    1

77    2

77    6

110    5

110    9

116    1

378    0

667    1

;

proc sql;

create table want as

    select id, sum(wire) as sum_wire

    from in_data

    group by id;

quit;

Anca.

Solution
‎09-11-2013 03:30 PM
Super Contributor
Posts: 1,636

Re: Multiple Observations

or you could use proc summary:

proc summary data=in_data nway;

var wire;

class id;

output out=want(keep=id total)  sum=total;

run;

proc print data=want;run;

Occasional Contributor
Posts: 13

Re: Multiple Observations

Linlin and Anca tilea thank you both for the quick response! I was able to get both to work.

Thanks!

Seth

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 257 views
  • 3 likes
  • 3 in conversation