I am looking for a method to transform my dataset from its current mean and standard deviation to a target mean and a target standard deviation.  Basically, I want to shrink/expand the dispersion and scale all numbers to a mean.
It doesn't work to do two separate linear transformations, one for standard deviation, and then one for mean.  What method should I use?

Suppose you start $\{x_i\}$ with mean $m_1$ and non-zero standard deviation $s_1$ and you want to arrive at a similar set with  mean $m_2$ and standard deviation $s_2$.

Then multiplying all your values by $\frac{s_2}{s_1}$ will give a set  with  mean $m_1 \times \frac{s_2}{s_1}$ and standard deviation $s_2$.

Now adding $m_2 - m_1 \times \frac{s_2}{s_1}$ will give a set  with  mean $m_2$ and standard deviation $s_2$.

So a new set $\{y_i\}$ with $$y_i= m_2+ (x_i- m_1) \times \frac{s_2}{s_1} $$ has mean $m_2$ and standard deviation $s_2$.

You would get the same result with the three steps: translate the mean to $0$, scale to the desired standard deviation; translate to the desired mean.
