It is know that if $f:\mathbb{C}\to \mathbb{C}^*$ is a continuous function, then for every $n>0$ there exists a continuous function $g:\mathbb{C}\to \mathbb{C}^*$ such that $f=g^n$.
Is it true that if $f$ is analytic then $g$ can be chosen analytic?
What happens in the real case? For example, if $n=2$, is it true that if $f:\mathbb{R}\to \mathbb{R}^+_0$ is analytic then there exists $g:\mathbb{R}\to \mathbb{R}$ analytic such that $f=g^2$ ?
Yes, this is true. If $f$ is entire and zero-free, there is a well defined holomorphic logarithm of $f$, (i.e. $f = e^g$ for some entire function $g$).
You can take $e^{g/n}$ as an $n$:th root of $f$.