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
What is the base category when two variables will interact with year dummy?Dear Stata User, I have one continuous independent variable (i.e., hhi), and other two variables d_n…
endogeneityDear researchers, I am using the generalized DID model “Two way-fixed effect”. I have more than two …
Is beta regression model best for panel data type of data?Hello everyone, I am a newly registered member here, but I have been using this site already for th…
Checking merges over a very large number of filesMy apologies in advance if this has been covered - I have looked but haven't found anything quite th…
one sided test of proportions using svyI am trying to do a one sided test of proportions with survey data. I've svyset the data. Normally I…
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