7 set template.chapter9splits;
32 dcl hash HoH(ordered:
"A");
33 HoH.defineKey(
"hashTable");
34 HoH.defineData(
"hashTable",
"H",
"calcAndOutput");
36 dcl hiter HoH_Iter(
"HoH");
41 set template.chapter9lookuptables
42 chapter9splits(in=CalcAndOutput)
45 if first.hashTable then
47 if datasetTag ne
' ' then h = _new_ hash(dataset:datasetTag
49 else h = _new_ hash(multidata:
"Y");
51 if Is_A_key then h.DefineKey(Column);
53 if last.hashTable then
60 HoH.find(key:
"GAMES");
63 HoH.find(key:
"PLAYERS");
66 HoH.find(key:
"TEAMS");
69 dcl hash pitchers(dataset:
"dw.pitches(rename=(pitcher_id = Player_ID))");
70 pitchers.defineKey(
"game_sk",
"top_bot",
"ab_number");
71 pitchers.defineData(
"player_id");
72 pitchers.defineDone();
74 if 0 then
set dw.players
78 format PAs AtBats Hits comma6. BA OBP SLG OPS 5.3
79 IP comma6. ERA WHIP WHIP_HBP BASES_IP 6.3;
83 set dw.AtBats end = lr;
84 call missing(Team_SK,Last_Name,First_Name,Team_Name,Date,Month,DayOfWeek);
87 players_rc = players.find();
88 do while(players_rc = 0);
89 if (Start_Date le Date le End_Date) then leave;
90 players_rc = players.find_next();
92 if players_rc ne 0 then call missing(Team_SK,First_Name,Last_Name);
95 do while (HoH_Iter.next() = 0);
96 if not calcAndOutput then
continue;
97 call missing(PAs,AtBats,Hits,_Bases,_Reached_Base
98 ,_Outs,_Runs,_Bases,_HBP);
104 _Reached_Base + Is_An_OnBase;
107 _Walks + (Result =
"Walk");
108 _HBP + (Result =
"Hit By Pitch");
109 BA = divide(Hits,AtBats);
110 OBP = divide(_Reached_Base,PAs);
111 SLG = divide(_Bases,AtBats);
116 ERA = divide(_Runs*9,IP);
117 WHIP = divide(sum(_Walks,Hits),IP);
118 WHIP_HBP = divide(sum(_Walks,Hits,_HBP),IP);
119 BASES_IP = divide(_Bases,IP);
124 do while (HoH_Iter.next() = 0);
125 if not calcAndOutput then
continue;
126 h.output(dataset:hashTable||
"(drop=_:)");