I am trying to generate a variable (CSSD) for dispersion which is equal to the sum of the squared deviations from the market of each of the following cryptocurrencies. However, not all of the currencies have data that goes back to the start of the period I am analysing. When there is missing values I want Stata to ignore that currency and calculate the statistic based on those with data. I am not sure if I have explained this very clearly but have tried my best. Does anyone have any ideas regarding a solution?
The code I am currently using:
gen SSD = 0
foreach var in Bitcoin Ethereum Cardano Binancecoin XRP Litecoin Chainlink Bitoincash Stellar Nem Dogecoin Theta Monero TRON EOS {
replace SSD = SSD + (`var'DayRtn - MarketDayRtn)^2
}
gen CSSD = 0
replace CSSD = sqrt((SSD/15-1))
Best,
Ted
Related Posts with How to generate a variable that uses other variables when I have missing values
Doubt about absorb() in reghdfeHi everyone! I am currently working with a rather big dataset (135mm observations) and I need to ru…
How to conclude significance of moderation effects?I want to explore moderating effects of m1. I also have another moderator m2, and here are the two c…
Negative binomial regression: Coefficient gets insignificant when control variable is loggedHi, please note that this question was cross-posted on StackExchange but didn't receive any feedbac…
OLS Regression and Fixed Effects ModelHi everyone, I was just wondering if anyone could explain the difference between using an OLS regre…
Correlated data and structural equation modellingI am trying to examine a cross-lagged model with twin data. Without taking into account the correlat…
Subscribe to:
Post Comments (Atom)
0 Response to How to generate a variable that uses other variables when I have missing values
Post a Comment