We report theoretical calculations of high harmonic generation (HHG) by intense infrared lasers in atomic and molecular targets taking into account the macroscopic propagation of both fundamental and harmonic fields. On the examples of Ar and N2, we demonstrate that these ab initio calculations are capable of accurately reproducing available experimental results with isotropic and aligned target media. We further present detailed analysis of HHG intensity and phase, under various experimental conditions, in particular, as the wavelength of the driving laser changes. Most importantly, our results strongly support the factorization of HHG at the macroscopic level into a product of a returning electron wave packet and the photorecombination transition dipole, under typical experimental conditions. This implies that the single-atom/molecule structure information can be retrieved from experimentally measured HHG spectra.