Volatility command

Hi everyone,
is there any command which will refer to standard deviation (volatility) or variance of an endogeneous variable? I have a DSGE model and want to do a ramsey policy, conditional on minimizing the volatility of consumption variable. How can I do that ?
Thank you

The usual way is to construct the variance from squared expected values. See for example