I am trying to find a way to select a frequency count for rows of a subgroup with no distinct identifiers (well, I guess the distinct identifier is a combination of statuses). Consider the sample data:
data have;
input Series $ Game Name $ Points;
datalines;
A 1 LeBron 2
A 1 LeBron 3
A 1 LeBron 2
A 1 LeBron 2
A 2 LeBron 2
A 2 LeBron 2
A 2 LeBron 3
A 3 LeBron 2
;
run;
Each row here is a shot LeBron took in a game within a series. I want The series/game summary, with a count for number of shots. Like this:
Series Game Name Freq Sum 2pt 3pt
A 1 LeBron 4 9 3 1
A 2 LeBron 3 7 2 1
A 3 LeBron 1 2 1 0
I have to use Proc SQL here, rather then proc means because I am pulling the data in from multiple tables. Also, I will have several thousand "Series" and many more "Games" and "Names" so please keep answer general Here is what I have:
proc sql;
create table want as
select Series,
Game,
Name,
sum(points) as totalpoints
from have
group by 1,2,3;
run;
Thanks.
Pyll