Galaxy pairs in the Sloan Digital Sky Survey – II. The effect of environment on interactions