Classic measurement:
The sample whose spectrum is to be measured is dissolved in a solvent which is transparent in the UV region. That means that it does not absorb in this region. Hexane, 95% ethanol, methanol and 1, 4 dioxane are generally employed as solvents. Now a days 'spectral grade' solvents are available which have high purity and have negligible absorption in the region of absorption by the chromophore.
In a classic measurement of a UV spectrum, the solution of the sample is taken within a suitable cuvette and the spectrum is run in the desired range of the wavelengths. The absorption by the solvent, if any, is compensated by running the spectrum for the solvent alone in the same or identical cuvette and subtracting it from the spectrum of the solution. This gives the spectrum only because of the absorption species under investigation. Within double beam spectrometers, the sample and the solvent are scanned concurrently.