The effect of the near surface on seismic land data can be so severe that static corrections are insufficient. Full-waveform inversion followed by redatuming may be an alternative, but inversion will work only if the starting model is sufficiently close to the true model. As a first step toward determining a viscoelastic near-surface model, we assume that existing methods can provide a horizontally layered velocity and density model. Because near-surface attenuation is strongest, we propose a method to estimate the P-wave attenuation based on viscoacoustic finite-difference modeling. We compare energy decay along traveltime curves of reflection and refraction events in the modeled and observed seismic data for a range of attenuation parameters. The best match provides an estimate of the attenuation. First, we estimate only the attenuation of the top layer and study the sensitivity to depth and velocity perturbations. Then, we consider multiple layers. We apply the method to synthetic and real data and investigate the effect of source wavelet and topography. The method is robust against depth and velocity perturbations smaller than 10%. The results are sensitive to the source wavelet. Incorporating the surface topography in the computed traveltimes reduces the uncertainty of the attenuation estimates, especially for deeper layers.