Dear Stata users

I need to calculate equially- and value-weighted variance and skewness for each id/month.

I am aware of rangestat equally-weighted code:

Code:
rangestat (sd) market_returns (skewness) market_returns, interval ( monthly_date . 0) by(id)
gen variance_market_returns=market_returns_sd^2
Is there any way to calculate value-weighted (by market_cap) variance and skewness using rangestat command?

If not, what is the alternative way out?

I am aware of collapse command which can adjust for weights but it does not have variance or skewness option.

Code:
collapse (sd) market_returns [weight=market_cap], by (id month)
Any advice is highly appreciated.

Thank you.