How do I replace variables in $\frac{d^2 \psi}{dx^2}$? I have 
$$\frac{d^2 \psi}{dx^2}=a^3 x \psi$$
but I need to change to $z$ by
$$z=ax$$
and end with 
$$\frac{d^2 \psi}{dz^2}=z \psi$$
How do I change variables here?

This is what I tried:
$$dz=adx$$
$$\frac{d^2 \psi}{dz^2} = \frac{d}{dz}\left (\frac{d \psi}{dz}  \right )$$
$$=\frac{d}{dz}\left (\frac{d \psi}{dx} \frac{dx}{dz}  \right )$$
$$=\frac{d}{dz}\left (\frac{d \psi}{dx} \frac{1}{a} \right )$$
...but then what do I do with $\frac{d\psi}{dx}$??

You are confusing yourself with the transformation.
$$
\frac{d}{dx} \to \frac{d}{dz}
$$
This is the what you want to get to, a replacement operator for $d/dx$. To finish this off we need
$$
\frac{d}{dx} = \frac{dz}{dx}\frac{d}{dz} = a\frac{d}{dz}
$$
so now we have a replacement for $d/dx$ you can now apply it twice to get what you want.
