As featured in: Data Management Solutions Using SAS Hash Table Operations: A Business Intelligence Case Study , and built from this github repository.
Chapter 6 Intrinsic Hash Table Grouping.sas
1 /* "Chapter 6 Intrinsic Hash Table Grouping.sas" from the SAS Press book
2  Data Management Solutions Using SAS Hash Table Operations:
3  A Business Intelligence Case Study
4 */
5 
6 data _null_ ;
7  dcl hash h (multidata:"Y") ;
8  h.defineKey ("Batter_ID") ;
9  h.defineData ("Batter_id", "Result", "Sequence") ;
10  h.defineDone () ;
11  do until (lr) ;
12  set Sample end = lr ;
13  h.add() ;
14  end ;
15  h.output (dataset: "Grouped") ;
16  stop ;
17 run ;