Sum rules and scaling in nonlinear optics