Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72784

Generating a new variable sorted by date

$
0
0
I want to generate a new variable. I have a dataset where I have two observations for implied volatility for each day, for every firm. Now I want to take the average of these two values, sorted by firm and calculated for each day. However, I'm stuck on how to incorporate the "if date== " in the command. I currently have

egen IV = mean(ImpliedVolatilityoftheOption) if Date==Date, by(Ticker)

where the commands work fine up until the 'Date==Date' part: I know the use of 'if' is wrong, but I believe it makes it more clear on what I want to generate there. Could someone help me out? Thanks in advance!

Kind regards, Nard

Viewing all articles
Browse latest Browse all 72784

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>