I need to find values of a variable that are two standard devotions above the mean. I want to create a signal for this variable when it crosses this threshold.

I have been doing something like below but this doesn't work at all.

egen memp= mean(emp)
egen stdemp= std(emp)
gen tstd=2*stdemp+memp
gen sig=0
replace sig=1 if tsdt>mean


and using this, I never have a signal. I thing I am mising something in here.