Player pa ab h 1b 2b 3b hr bb avg obp slg ops
ab = pa - bb
h = 1b + 2b + 3b + hr
avg = h / ab
obp = (h + bb) / pa
slg = (1b + 2*2b + 3*3b + 4*hr) / ab
ops = obp + slg

NOTE: (for more accurate rate stats include HPB and SF in your walk totals)