Increasing loss of cables to attain dynamic range
Advice on cable lengths - as short as possible consistent with connecting the equipment you need to. But long enough to move equipment for debugging without cable strain or disconnecting, don't stint yourself. Do not increase the lengths of cables to obtain loss.

Cables that are good (have low loss and good match) to 40GHz tend to be expensive, with easily damaged connectors. It is a good idea to have some more robust lower frequency cables as well, for system setup and debug. Once connected though, it is better to leave the good cable in place without frequent reconnection.

Where you need to increase loss in a link, use an attenuator, or several small pads in series. These will have attenuation that varies less with frequency, usually described as 'flatter', than that for cable.

Often you will 'pad' (connect an attenuator to) the output of a sig-gen or the input of a spectrum analyser to improve the port match, which improves the level measurement uncertainty.