7 dcl hash HoH(ordered:
"A");
8 HoH.defineKey(
"hashTable");
9 HoH.defineData(
"hashTable",
"H",
"ITER",
"CalcAndOutput");
11 dcl hiter HoH_Iter(
"HoH");
16 set template.chapter9lookuptables
17 template.chapter9splits(in = CalcAndOutput)
20 if first.hashTable then
22 if datasetTag ne
' ' then h = _new_ hash(dataset:datasetTag
24 else h = _new_ hash(multidata:
"Y");
26 if Is_A_key then h.DefineKey(Column);
28 if last.hashTable then
35 HoH.find(key:
"GAMES");
38 HoH.find(key:
"PLAYERS");
41 HoH.find(key:
"TEAMS");
45 if 0 then
set dw.players
48 format PAs AtBats Hits comma6. BA OBP SLG OPS 5.3;
52 set dw.AtBats(rename=(batter_id=player_id)) end = lr;
53 call missing(Team_SK,Last_Name,First_Name,Team_Name,Date,Month,DayOfWeek);
55 players_rc = players.find();
56 do while(players_rc = 0);
57 if (Start_Date le Date le End_Date) then leave;
58 players_rc = players.find_next();
60 if players_rc ne 0 then call missing(Team_SK,First_Name,Last_Name);
62 do while (HoH_Iter.next() = 0);
63 if not calcAndOutput then
continue;
64 call missing(PAs,AtBats,Hits,_Bases,_Reached_Base);
70 _Reached_Base + Is_An_OnBase;
71 BA = divide(Hits,AtBats);
72 OBP = divide(_Reached_Base,PAs);
73 SLG = divide(_Bases,AtBats);
78 do while (HoH_Iter.next() = 0);
79 if not calcAndOutput then
continue;
80 h.output(dataset:hashTable||
"(drop=_:)");