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
Calculating significance between model coefficients in different modelsIf I want to calculate if the difference between coefficients in two different models is statistical…
How to store a variable's value label into a global macro?Hi stata masters, I want to store a variable's value label into a macro, and then I use this macro …
psychometric conversion scale - standard score to z-scoreI have a number of variables which are standard scores or scaled scores (language and congnitive tes…
reshape monthly dataHello Everyone, I am here stuck unable to reshape a panel monthly data from US states. I extracted …
Building Tertiles based on Observations inside a Variable.I'm trying to see high, intermediate and low volume centers based on Number of Patients treated in t…
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