Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding various means per group

Status
Not open for further replies.

littleteacher

Technical User
Jul 4, 2011
1
US
I have a fairly large data set that looks something like this:

Group ID Successes
1 1 3
1 2 10
1 3 4
2 1 3
2 2 8
2 3 2
3 1 9

And so on. But there are 1000 groups, and 50 IDs (so 50 observations in each group).

I need to do a couple of things that I've had difficulty figuring out. One is I want to find a way to get the average number of success per group. One number. Right now everything I try gives me 1000 numbers. It'd also be helpful to see the min and max total successes.

I also need to be able to make a histogram or line plot of the total number of successes in each group plotted against the frequency with which they occur.

Seems like if I could take my data set and get one that looks like this:

Group TotalSuccesses
1 17
2 13

And so on, this could be easier, but I haven't had any luck creating that set.

Tips?
 
SAS has many was to do this type of thing. Here is an example using proc summary/means

Code:
data have ;
input Group    ID     Successes ;
cards ;
1            1        3
1            2        10
1            3        4
2            1        3
2            2        8
2            3        2
3            1        9
;;;

proc summary data=have nway ;
   class group ;
   var successes ;
   output out=want(drop=_:) sum= min=Min max=Max ;
   run;quit;
proc print;run;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top