In the attached data below, in the first column there is 1, 1, 1…. 1 which means first security, then 2, 2, 2…..2 mean second security and so on till 501 which means 501th security. Each number is 19 times in the month of July, which shows that particular security is traded for 19 days except a few securities . Second column is the residuals series of 501 securities in the month of July, 2005. I got these residuals after employing OLS on daily data for each security with the help of Stata.
Similarly, I have got these residuals series of 501 securities for each month from the period of July 2005 to June 2019. Below I am just showing a sample of my data set.
Now I want to calculate = [Standard Deviation * (trading days) 1/2 ] for each security every month. In MS Excel I have to calculate for each security which is very time consuming.
I run this command:
Code:
dataex Securities Residuals
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int Securities double Residuals 1 .06100905526664617 1 .018200765921769196 1 .002302944490864386 1 -.033965307491921164 1 .0009181674237631124 1 .06403532828369113 1 .05333690686003768 1 .015190512297211294 1 .005032692203814661 1 -.03426425281175801 1 -.002881117047946408 1 -.03371983377341705 1 -.038556254176230764 1 -.011430591851673392 1 -.019482834034763565 1 -.03404594016616286 1 -.05031003388061296 1 .014875586087672074 1 .023754206399016434 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 2 . 3 -.004844024826951678 3 -.018068070155601464 3 .06367076469697697 3 .03809349127519174 3 -.004253538158807668 3 -.0028536664163587733 3 .0046647922571916856 3 -.017304186793684666 3 -.015854318387752496 3 -.004021355277043498 3 .013462510497008263 3 -.007330210581243784 3 -.013201097967129819 3 -.0034195904319810643 3 -.01583547289747817 3 -.01513205173650813 3 .01646283312031617 3 .001470463671279395 3 -.015707271887423033 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 4 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 5 . 6 .00398852613465446 6 -.007123296989719599 6 -.006353320411417913 6 -.006491804673747924 6 .004909149193909702 end
Thank you
PRIYA
0 Response to How to run this formula on stata = [Standard Deviation * (trading days) 1/2 ] , for a number of series.
Post a Comment