A random phase approximation (RP A) calculation and a direct sum over states is used to calculate second-order optical properties and van der Waals coefficients. A basis set expansion technique is used and no continuumlike functions are included in the basis. However, unlike other methods we do not force the basis functions to satisfy any sum-rule constraints but rather the formalism (RP A) is such that the Thomas-Reiche--Kuhn sum rule is satisfied exactly. Central attention is paid to the dynamic polarizability from which most of the other properties are derived. Application is made to helium and molecular hydrogen. In addition to the polarizability and van der Waals coefficients, results are given for the molecular anisotropy of H 2 , Rayleigh scattering cross sections, and Verdet constants as a function of frequency. Agreement with experiment and other theories is good. Other energy weighted sum rules are calculated and compare very well with previous estimates. The practicality of our method suggests its applications to larger molecular systems and other properties.