I have the following panel data of returns:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float month double(return RICHF RIUSD RICAD) long portfolio 480 . . . . 1 481 -.017411958510118786 .001759268798819713 .030178382992555697 .028545060473398633 1 482 -.011706451707231613 .0020123034234469372 .020628016114266165 .01366124060703592 1 483 -.020889222029351395 .0023485905796301054 .0031331168222798714 -.0025021755612827734 1 484 .0003122670588473486 .002663410866920346 .03407966490218543 .014924361789469867 1 485 -.0162730980313176 .0025959465680680527 -.04143246507962394 -.029682926648015733 1 486 -.007534113359743744 .0027874252104072017 .00865384608338804 .007399075753449846 1 487 .027270945715965444 .002822437972181291 .041092379326212965 .03733378085729284 1 488 -.02539233109431005 .002860134581982532 .027639959286014138 .02455552461243252 1 489 -.035026991387481 .0029395073797822135 .011255679431180074 -.006631599942943928 1 490 -.008284579578938356 .00286417229173197 .005864112209302457 -.014203186268446837 1 491 -.007880118847694129 .002853399284193925 -.04924105097783883 -.037377127811305776 1 492 -.01813151041666672 .002765867856804771 -.031648599753490214 -.019862250262440203 1 493 -.016156659925515737 .002806278663769479 .02571161162205217 .012791276213918158 1 494 -.044503352915407635 .0028130093637781517 .014881000694510989 -.009179817174782785 1 495 .009475107270910499 .002729482807901862 .014941905976130142 .01501494838090478 1 496 .0611615097064202 .0026080943135087242 .025239870276087772 .03575418394442024 1 497 .0150894944196307 .002632384948421107 .018782928107090986 .030347875783539424 1 498 -.03304936322947527 .002658020740056166 -.015561473902034549 -.019124617613289818 1 499 -.01465770731543703 .0026202404401427515 -.0437017200474496 -.04925922953421506 1 500 -.06619766254396908 .0025932495489568996 -.026819106422571702 -.043606820561290165 1 501 .0019320501603965479 .001883147698873655 .0019660780095002435 .0001864450224424068 1 502 .03461281911345582 .0017252023849956277 .0100515122603582 -.003094761687630198 1 503 -.0027429696749463606 .0016543063426528448 .002174019702508153 .01187645303413497 1 504 .014986776373787869 .0015191836132719683 .0093111436069002 -.0048778760218273565 1 505 .008465547191661704 .0014030144023795543 .01629251417131288 .01936406900074749 1 506 .009485421618952605 .001437193347420651 -.01376383346194045 -.007960540419734556 1 507 .007109786478892488 .0013523951645808552 -.011798921606409793 -.007782840453658987 1 508 -.012797632494465194 .001299012149938772 -.0390931929084105 -.01888784442020368 1 509 .0006521813750728356 .0010206427160042164 -.0309106937580637 -.01879426537040388 1 510 -.06845728137577756 .0010302504508852284 -.04323993900600365 -.05135190027116044 1 511 -.0036455584332690805 .0006821597904800303 .01827183748089194 .004999542821695187 1 512 .005198837037402093 .0006242439578545422 -.0025015567564394305 -.00645287836416555 1 513 .007059342598720431 .0006214796233974251 .000948613349221769 .0006236174635263338 1 514 .0015090665693076044 .0006173412411494272 -.01701274880866261 -.012053845982042807 1 515 -.015724111113811445 .000618723481760286 -.017509772957716413 -.008674948153903886 1 516 -.009098765432098865 .0005124448979871854 -.043819741975619504 -.03099238273522654 1 517 .00928198547275838 .0005013900307619945 -.010734222148799197 .009279791900711983 1 518 .01056685759431164 .0004751479870550579 .0007867699613001403 .02689135585349984 1 519 .026482947327274298 .000260734105672622 .013376460623230044 .027092076745894964 1 520 .00918697638994681 .00025657927572675376 -.04823081858081134 .004442189176757285 1 521 .034939389651431396 .0002344225171564407 .007576827257030567 .03310625210216337 1 522 .02496382467214331 .00023995805727516917 .03257572611682992 .012433746373911769 1 523 .0018564218857688441 .00023857835958485119 .015986712230009748 .007354514990502057 1 524 .011339805825242744 .00022195385012535596 -.005492247067867936 .019766753509909286 1 525 .00787738488375922 .00021156198803762294 -.03700036232288413 -.005581879274231986 1 526 .036640722799760495 .00020740491063886424 .006390715923945262 .01503728173036204 1 527 -.01842887295103479 .00022195385012535596 -.04827009207281918 -.04714883323042824 1 528 .022914972827249747 .00021640890030050208 -.018695248940342846 -.004366445063676576 1 529 .011786483716454965 .00020532630066694146 .0037644670397368766 -.019912079064266633 1 530 -.010047030854307804 .00021502053159649925 .0274339958626395 .028948519066960766 1 531 .007016591314880083 .00020809499864316017 .01619569046500703 .006572274572007401 1 532 -.06327958940328693 .0002261102624447897 -.011279375193865654 -.03611446102449688 1 533 -.04010316353412591 .00021640890030050208 -.024245448836465552 -.008578687103537305 1 534 .028148387319964385 .0004143295155680793 -.004204941666666763 .023612284834477425 1 535 .006550022431583757 .00044059740363810995 .014303990749001473 .022837724097493045 1 536 -.011142806204314515 .0005152042617388997 .0016502384576959814 .02088642028225298 1 537 .01924637158568454 .0005814701329551752 -.02293350640812372 .009944747080081926 1 538 -.00252067394861355 .0006035507925561401 -.05017941740598761 -.009221331149489177 1 539 -.02551427558077679 .0006145849741192588 -.017672195718340725 -.035682266399351896 1 540 .028400172880507668 .0005952722081801198 .03031037991719011 .025421299993804585 1 541 .029518132250965 .0006228618011265841 .009656165235942456 -.001745459593654486 1 542 -.00936748023375733 .0006297558231231903 -.012493466953791357 .006661155299718971 1 543 .0029821289147220487 .0006435505744648573 .019391573258919357 .0029091101602059513 1 544 .008757608848428466 .0006311378751067132 .020044281119559824 .004157220466727182 1 545 .040406855231990946 .0006228618011265841 .042124381884492454 .0545150713485649 1 546 .0034304787217604993 .0006214796233974251 .024540626524782533 .03883231728567823 1 547 -.013397807071578227 .0006269999322361386 -.02318526517871613 -.008567144961196288 1 548 .008449619663055907 .0006311378751067132 .005665940237970764 .02748452835137573 1 549 .0013930307189069513 .0006559615803181096 .01925382602642754 .01873728975090891 1 550 -.006316592131566434 .0007055886783371434 .020469477009753982 .016895468939518477 1 551 .005309385791171017 .0008377954090970086 -.002389246674242232 .014253776717873335 1 552 -.010934034761978517 .0008377954090970086 -.01833558490378061 -.01579018132963216 1 553 .009636543776398776 .0008494947126305163 .024545741426088893 .03145892974696593 1 554 -.020845169354088977 .0009746169930944237 .0025932724505116035 -.005386644762191839 1 555 -.00298551550252657 .0010350621770103263 -.014938211694913908 -.0036453207672660984 1 556 -.013660219240699156 .0011098666182609573 -.04553335874915172 -.016789079339875092 1 557 -.022174066962034944 .0011784402824199791 .012898179957170242 .008410518691591436 1 558 .022029621503016905 .0012579269787644787 .0073636699780591916 -.006814772892911098 1 559 .009263831340303508 .0012825803067024744 -.0012074130185354913 .007803647561175901 1 560 -.00011699513938367989 .0013893343063426933 .013743306933264025 .014897141868415452 1 561 .011094564408041574 .0014966436497785285 .014563242961367608 .002674683152621923 1 562 .004229219488075087 .0015369411743291206 -.01758510665312337 -.02494502105212068 1 563 -.004410455188308626 .0016106549662961989 -.017647913223810017 -.0326575664227092 1 564 .023812530252330877 .0017354228296928564 .03081364722364646 .009971666649123665 1 565 -.0027647306700103735 .0018069338440696026 -.0008922854201519029 .002845605218783813 1 566 -.004679061714144339 .0018314389855391688 -.014519641454412256 -.013248206988637783 1 567 .038695715202849534 .001892673008752288 -.0024801088235696152 .026608858716852996 1 568 .004665490325088895 .001937551809032545 .009966669967214447 .04531500926497829 1 569 .0304726183034163 .0020353925068166134 .012086786315826858 .03961193177669361 1 570 .008252286952335153 .0022226272943570713 -.018823905109489104 -.005610910967930469 1 571 -.04928037284995268 .002228726302896611 -.0008965173194331894 -.00879711554775392 1 572 .007765176248405448 .002382424708631703 -.014449649000709035 .017183676029230842 1 573 .05248205741626788 .0022917254968366496 -.006633220720720586 .04434623231270146 1 574 -.04772458209025898 .0022659864439975586 -.04175122604853407 -.03393247327228181 1 575 -.012064129851013461 .0022592152231402096 .01619985693593575 -.019746501257149815 1 576 -.02322491015070527 .002268701293987485 -.03269685059962556 -.03986719640845054 1 577 .025405561395914544 .0021846660196855883 -.009246323863233801 .003109339167477859 1 578 -.0607291111758852 .002301208183839165 -.0704897720598493 -.07274998281135384 1 579 .00957741655876454 .0023729504702099113 .0008966480676806969 -.0098989160497737 1 end format %tm month label values portfolio portfolio1 label def portfolio1 1 "RBAUD", modify
I need to merge the two values base return and interest adjusted return into one observation. This means I should have one observation for each currency per period containing both the interest adjusted return and the base return. The observations should only contain two returns, "return" and "returnI".
Unfortunately I can't figure out how to do so?
Thank you very much for your help in advance!
0 Response to How to merge parts of panel data by id
Post a Comment