Formula

SLG = (Total bases) / (Number of official at bats)

 

Where,
Total bases = (Home Runs * 4) + (Triples * 3) + (Doubles * 2) + (Singles)
Number of official at bats = Home Runs + Triples + Doubles + Singles + Outs