Formulas for calculating NMR chemical shifts at second-order many-body perturbation theory using the gauge-including atomic orbital method are presented and their implementation is discussed. The method is applied to study correlation effects on calculated O-17 chemical shifts.