copy starting from the next line -------------- --------
copy up to and including the previous line --------- --------
Hello
Actually I have been searching about calculating standard deviation over 3 or 5 years period.
I have these 5 variables. Var1 to Var5
I need to calculate the standard deviation of these 5 combined variables. These are ROEs for last 5 years. Var1 means t-1 Var2 means t-2 and so on to t-5.
Can someone please help me to formulate the code?
Many thanks and warmest regards
Qureshi
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str90 Name float(Var1 Var2 Var3 Var4 Var5) "3Com Corp" .28479278 .2588414 .2794736 .25828582 .28426063 "3D Systems Corporation" .029287584 .01015675 .03873209 .01015675 .02928722 "3M Company" .009562623 .010082494 .009555012 .010200173 .009562623 "4Kids Entertainment Inc." .10297298 .117632 .10297298 .117632 .1029783 "51job Inc Sponsored ADR" . . . . .015517205 "99 Cents Only Stores LLC" .02816265 .02905768 .02953569 .02905768 .028169755 "A. O. Smith Corporation" .02946457 .033737905 .02946457 .033737734 .02946457 "A.C. Moore Arts & Crafts Inc." . . . . . "AAR CORP." .01151925 .011588562 .01151925 .010475408 .011518214 "ACADIA Pharmaceuticals Inc." . . . . . "ACCO Brands Corporation" .015334416 .020152457 .015334416 .019888293 .015334416 "ADTRAN, Inc." .03952639 .04041027 .04007301 .04108277 .0395258 "AES Corporation" .15147103 .11523314 .15147103 .12520427 .16001324 "AGCO Corporation" .015598472 .020328704 .014394488 .02163649 .015598472 "AGL Resources, Inc." . . . . .013300225 "AK Steel Holding Corporation" .4732365 .4808741 .4732365 .4739559 .4732424 "AMCOL International Corporation" .007496022 .005465321 .008632958 .005465321 .007493988 "AMERIGROUP Corp." .08741052 .09043673 .08721062 .09763097 .08649644 "AMETEK, Inc." .0036959425 .00051607937 .00013075769 .00051607937 .0036959425 "AMN Healthcare Services, Inc." .0596791 .06133062 .06001616 .0620384 .0596255 "AMR Corporation" . . . . . "ANADIGICS, Inc." .0034524146 .010032417 .0034524146 .02488092 .003451811 "ANN INC." .013525188 .016433358 .013823856 .017300103 .013519794 "ANSYS, Inc." .01269663 .0102956 .01269663 .01070553 .012526207 "ARC Document Solutions, Inc." .004270211 .004492957 .0040340833 .0044276267 .004274767 "ARCA biopharma, Inc." .20866165 .15190965 .202149 .1300157 .20527107 "ARIAD Pharmaceuticals, Inc." . . . . . "ARO Liquidation Inc" . . . . . "ARRIS International Plc" .06152731 .05537947 .06089373 .05455793 .06152731 "ASGN Inc" .02295653 .015852956 .022727383 .018602727 .02295589 "AT&T Inc." .07628618 .07795052 .07743849 .07854424 .07627793 "ATC Technology Corp." .026221305 .02218735 .026221305 .030550525 .02622095 "ATMI, Inc." .07156387 .07088136 .07150381 .07012269 .07156348 "ATP Oil & Gas Corporation" .00935457 .004560397 .005391859 .006361721 .009059085 "AVX Corporation" .012153514 .009736385 .011117604 .009736385 .012152962 "Abbott Laboratories" .01526564 .015100284 .015309768 .01506706 .012369655 "Abercrombie & Fitch Co. Class A" .01037959 .010506317 .010521352 .010521352 .01037649 "Accuride Corp." . . . . . "Achieve Life Sciences, Inc." . . . . .6586132 "Achillion Pharmaceuticals, Inc." . . . . . "Acme Packet Inc." . . . . . "Acorda Therapeutics, Inc." . . . . . "Actel Corp" .02941588 .0003506811 .02941588 .0003506811 .02941615 "Actions Semiconductor Co. Ltd. Sponsored ADR" .019618787 .020821184 .019618787 .020881414 .019619294 "Activision Blizzard, Inc." .01523839 .003512189 .015406075 .0044890437 .01523847 "Actuate Corporation" .13801986 .1435931 .13801986 .13642749 .13661647 "Acusphere, Inc." . . . . . "Adhera Therapeutics Inc" .05934539 .0605937 .05747719 .06053425 .06139579 "Adolor Corp" .08171767 .08850466 .0803478 .0844574 .07996187 "Advance Auto Parts, Inc." .010774225 .01069438 .01078573 .01078573 .0107783 "Advanced Analogic Technologies" .06727746 .070165545 .06727746 .06655544 .06727739 "Advanced Emissions Solutions, Inc." .031483766 .028194273 .031483766 .028194273 .031483766 "Advanced Energy Industries, Inc." .06063449 .07272325 .06063449 .0605508 .06063548 "Advanced Micro Devices, Inc." .06115305 .07100518 .06068933 .07082005 .06115121 "Advent Software, Inc." .20657475 .21555886 .20415595 .21555886 .20655186 "Advisory Board Company" .007538611 .008042071 .007538611 .006279957 .007542882 "Aegion Corporation" .029347684 .02229208 .029519755 .02229208 .02920757 "Aetna Inc." . . . . . "Affymetrix, Inc." .03734207 .035485614 .03753141 .03517939 .03646575 "Agenus Inc." .074112445 .086624 .074112445 .086624 .07763283 "AirTran Holdings Inc" .11964883 .1144033 .11938146 .1081525 .119523 "Airgas, Inc." .02596821 .026755143 .02591928 .027287055 .026017353 "Airspan Networks Inc." .22493984 .22713667 .22493984 .23548466 .22493894 "Akamai Technologies, Inc." .021656835 .02176828 .024490403 .02474128 .021723974 "Alaska Air Group, Inc." .066105045 .0595028 .06629172 .05971277 .066141196 "Alaska Communications Systems Group, Inc." .032722034 .03592085 .032722034 .035182662 .032730386 "Albany Molecular Research, Inc." .028366495 .02918954 .028366495 .02918954 .02837525 "Albemarle Corporation" .05043045 .04378847 .0501916 .04399343 .05043497 "Alcoa Corp." . . . . . "Alere Inc." .009887028 .009465266 .009887028 .009465266 .010602482 "Alexion Pharmaceuticals, Inc." .12674125 .12451904 .127482 .12451904 .12871738 "Align Technology, Inc." .0005035773 .014277924 .003496416 .014277924 .00012914836 "Alkermes Plc" .03788972 .04010185 .03788972 .04002559 .03856196 "Allegheny Energy" . . . . .02008499 "Allegheny Technologies Incorporated" .07285768 .07315785 .07225707 .072949976 .072919875 "Allergan plc" .070159614 .0686696 .070291564 .069061175 .07131915 "Allergan, Inc." .03328605 .03389776 .034741774 .034834404 .03352558 "Alliance Data Systems Corporation" .0386684 .03961644 .0403538 .04147739 .03856432 "Alliance Holdings GP, L.P." . . . . . "Alliance Resource Partners, L.P." .07718674 .0630518 .069211476 .06302868 .07748682 "Alliant Energy Corp" . . . . .02547442 "Allos Therapeutics Inc." . . . . . "Allscripts Healthcare Solutions, Inc." .05378028 .06027872 .05874081 .05948707 .05338494 "Alnylam Pharmaceuticals, Inc" .029848233 .034176826 .032692544 .034189552 .028280064 "Alon USA Energy, Inc." .00901553 .006457254 .003926471 .007895425 .008690119 "Alpha Natural Resources, Inc." .120255 .08272768 .1162774 .08272768 .12045924 "Alphabet Inc. Class A" .016839622 .017714206 .017681312 .01706666 .016750256 "Alphatec Holdings, Inc." . . . . . "Altera Corporation" .014754243 .01702451 .013588458 .01682645 .01475424 "Altria Group Inc" . . . . .02657913 "Altus Pharmaceuticals Inc." . . . . . "Amazon.com, Inc." .02094745 .01928105 .02094745 .020735364 .020948645 "Amedisys, Inc." .014885787 .016799614 .016385157 .01687916 .014889896 "Ameren Corporation" . . . . .0360288 "America's Car-Mart, Inc." . . . . . "American Axle & Manufacturing Holdings, Inc." .367699 .368799 .3687301 .3668236 .367699 "American Commercial Lines Inc." .015538037 .015545294 .014489554 .015808813 .015520439 "American Eagle Outfitters, Inc." .015966155 .021515764 .022090174 .021437436 .015964024 "American Electric Power Company, Inc." . . . . . "American Greetings Corporation Class A" .20073855 .2127246 .2113591 .2127246 .18045157 end
Hello
Actually I have been searching about calculating standard deviation over 3 or 5 years period.
I have these 5 variables. Var1 to Var5
I need to calculate the standard deviation of these 5 combined variables. These are ROEs for last 5 years. Var1 means t-1 Var2 means t-2 and so on to t-5.
Can someone please help me to formulate the code?
Many thanks and warmest regards
Qureshi
Comment