Hi,
I use the following equation for calculating return for a portfolio of stocks.
gen MOMf3_p1= ( for4r1 [_n-4] + for3r1 [_n-3] + for2r1 [_n-2])/3
for4r1 to for2r1 are returns
_n denotes time
the issue is if one of the returns above go missing the answer I get is a "."
I understand I cannot use egen function to resolve this.
Is there a way?
Thank you.
Sampath
Related Posts with Dealing with missing data
Interpreting conditional logit model in StataDear all, I am a student analysing a choice experiment in Stata with the clogit command (conditiona…
keep if a variable is one of many values?I'm wondering whether there is a simple way to keep observations only if a variable is equal to one …
Winsorizing before or after long-transformationDear users, I have a question regarding the handling of outliers in a log-log regression framework.…
Conversion of dates in STATAI have a date variable in STATA in the format 13jul2000. I want to convert it into a date with gen …
How to get legend content equals the variable valueHello everyone, I am trying to plot data on covid-19 cases by country. Here my data: Code: * Exam…
Subscribe to:
Post Comments (Atom)
0 Response to Dealing with missing data
Post a Comment