Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stock prices-panel data

    Hello,

    As I don't have any previous experience with stata and now I have to use it for an assignment I faced some problems. So, I would like to make a question; I have collected my data from datastream fro all stock prices for 7 countries and for the period 01/01/2008-31/12/2015 and I compute differences of the logarithm of all stock prices. So, now i have a column which has all the countries, another column with the ISIN codes and then columns for each day from 2008-2015. But, I cannot work with this output because for example when i want to create a table for the descriptive statistics I have to choose only one of the columns with the dates whereas I want my descriptive statistics to include all the dates.. Also I should have panel data, I found the command that I have to use but I should have a column with all the dates which i don't have because i have the ln of stock prices for all the dates between 2008-2015.. I dont know if my explanation was so clear. Please let me know if you didnt understand and i will try to explain it better. Thank you in advance for your help. I am looking forward to receiving any help.

  • #2
    First, in Stata we speak of variables, not columns. Stata is not a spreadsheet, even though in the Browser it may look like one. If you think of Stata as a spreadsheet, you will make a lot of mistakes. When working with Stata you should try to put anything spreadsheet-related out of your mind.

    So the key piece of missing information here is the names of your variables that correspond to the different days. It's not really a matter of explaining; it's a matter of showing an example. So run -ssc install dataex- to install the -dataex- command (if you don't already have it). Then run -help dataex- to get the simple instructions for using it. Then use -dataex- to create an example of your Stata data set and post it here. This is not a difficult problem, it's just a matter of applying the -reshape long- command. But to do that, the details of your variable names and storage types need to be known. A -dataex- example will provide that.

    Comment


    • #3
      It is not clear, but it sounds like you have different variables for each date. You'll find that reshaping this into the long form will make everything much easier.

      Comment


      • #4

        Here is an example of my data
        Click image for larger version

Name:	stata1.png
Views:	1
Size:	76.3 KB
ID:	1410033

        Comment


        • #5
          Well, at least on my computer, it's not an example of your data. It's just an unreadable image file. Unreadable results of posting screen shots are pretty much the rule, not the exception. Even if it were readable, it would be useless: you can't import a picture into Stata to work with the data. Please read FAQ #12 to learn about the -dataex- command, which is the helpful way to show example Stata data on this Forum. Please repost using -dataex-.

          Comment


          • #6
            Code:
            * Example generated by -dataex-. To install: ssc install dataex
            clear
            input str8 Country str15 Code double(Date0201108 Date0302108 Date0403108)
            "Italy"    "IT0003128367(P)"  -.007404279020984061   .014754137393018008  -.011668191416815299
            "Italy"    "IT0000062072(P)"   -.01396611294767558  -.001310649639955308 -.0032824503837054486
            "Italy"    "IT0003132476(P)" -.0019980026626731373    .01547957084838636  -.008702586569362403
            "Spain"    "ES0178430E18(P)"  -.010858341795213722  -.020222875787938133  -.006052961771064513
            "Spain"    "ES0113900J37(P)"  -.013607956802442533   -.00964270336012163  -.014640669501002623
            "Spain"    "ES0173516115(P)"   .013039316382324806   .006858420237372265  -.010918878931014842
            "Ireland"  "IE00BY7QL619(P)"    -.0116650402955609  -.016468429354995706   -.01253035547131276
            "Ireland"  "IE00B4BNMY34(P)"  .0008322930151694052  -.017343092038290653    -.0150678046199357
            "Spain"    "ES0167050915(P)"  -.013620754632633236   -.02653359411472911   -.05392575025441948
            "Spain"    "ES0144580Y14(P)"  -.024329655735718214   .008824139769920913   .012608486233243177
            "Italy"    "IT0003796171(P)"                     .                     .                     .
            "Ireland"  "IE00BTN1Y115(P)"  -.015435808129839135   .005037794029957077  -.011523426816555382
            "Ireland"  "IE0001827041(P)"    .02243422443622567    .04078377896815777   .008090870184118693
            "Spain"    "ES0113211835(P)"  -.010799650246881232  -.008481111925456197  -.020893324672861535
            "Spain"    "ES0148396007(P)"  .0035633723416141905   -.02351355931047916   -.07013804885430819
            "Spain"    "ES0116870314(P)"  -.015107353310698013   .006573809250873808  -.047743832290300325
            "Spain"    "ES0177542018(P)"                     .                     .                     .
            "Italy"    "IT0003497168(P)"  -.013025643017155919  -.011990551331911181  -.015805800171188045
            "Spain"    "ES0130670112(P)"  -.026768958438936785  .0025391924893378715   .003377844168883204
            "Ireland"  "IE00B8KQN827(P)"   -.03452417793326523   .026550232094120663   -.04312936089703179
            "Italy"    "IT0005239360(P)"  -.021352698033515694   .006275107234383626   -.02442476482851319
            "Italy"    "IT0000072618(P)"  -.020538638889513683  .0028330350615715094   -.00756588227884758
            "Italy"    "IT0004810054(P)"  -.010671212362686866   -.01950336902773797   -.03224384964809346
            "Portugal" "PTEDP0AM0009(P)"  -.004484312447328831   .013393057336438252   .006629858538669486
            "Portugal" "PTJMT0AE0001(P)"   .016529301951210496 -.0018231545615150502   .019874186207083477
            "Ireland"  "IE0002424939(P)"   .010196462963471653    .01828423809414481   .016256774360305926
            "Ireland"  "IE00BY9D5467(P)"  -.009626138751773983  -.004848042312933565   -.02536573628356331
            "Portugal" "PTGAL0AM0009(P)"  -.010385444533480115  -.019418085857101364   -.05232581900173994
            "Ireland"  "IE00B6330302(P)"   -.03436751153187512  -.013905288064114618   -.03844475586519103
            "Italy"    "IT0003856405(P)"  -.012826993446154233  -.006008650342403499  -.015899479124151128
            "Italy"    "IT0004827447(P)" -.0074754358607971305  -.020938636987073433  -.014330265522652486
            "Spain"    "ES0118900010(P)"  -.032526086113981556   .004711859069967517   -.03767444892031202
            "Ireland"  "IE00B58JVZ52(P)"   -.04245731786098572  .0028600632366266865  -.050198744492355285
            "Spain"    "ES0105027009(P)"                     .                     .                     .
            "Italy"    "IT0000068525(P)"  -.012842437627802905   .030548061004342486  -.020260369820762403
            "Italy"    "IT0001479374(P)"  -.027513976200776114  -.028778964550043362  -.017178336535084604
            "Spain"    "ES0126775032(P)"                     .                     .                     .
            "Spain"    "ES0140609019(P)"   .005789739414386874  -.019422477102422064                     0
            "Ireland"  "IE00B1RR8406(P)"   .014369592650391283  -.008845701198826106   .008405269568716012
            "Italy"    "IT0004176001(P)"  -.044801681151043216  -.007458083047203967   -.06841376818992462
            "Ireland"  "IE00BYTBXV33(P)"  -.008646832949723793  -.059485453286179935   -.04356191980490198
            "Italy"    "IT0000433307(P)"   .015600940442479727 -.0012391575315482406   -.03340997788162592
            "Greece"   "GRS298343005(P)"   .010582109330536937   -.01591545530589933   .022908490796869962
            "Italy"    "IT0003826473(P)"  -.006598754315198185   -.02877804698037356  -.018674231915709938
            "Spain"    "ES0125220311(P)"   -.03711088138745122   .009526149676423401   -.03448201778172333
            "Greece"   "GRS426003000(P)"   .020785193466077434                     0  -.008663832933732518
            "Italy"    "IT0003506190(P)"   -.01202777531442889  -.003911578082657741  -.020586873117423465
            "Spain"    "ES0122060314(P)"   -.01568836389459438  -.030294439386866046   -.05743491852019966
            "Ireland"  "IE0004906560(P)"    .02052523594473099   .004504512121104476  -.006764400088542288
            "Portugal" "PTSON0AM0001(P)"  -.015314234973042629  -.020732414695754597   -.03787948777217709
            "Spain"    "ES0113860A34(P)"  -.013596216797447491  -.024914264607664327   -.02989963383704697
            "Italy"    "IT0003865570(P)"  -.028519199795812966  -.013468217050866649   -.04560034181223571
            "Spain"    "ES0111845014(P)" -.0022690287444326884  -.020677930897552432   -.00746029354101907
            "Ireland"  "IE00BLNN3691(P)"     .0336828688742119  .0007044734352636972   -.03191227370957028
            "Italy"    "IT0000784154(P)"   .008318263515894486   -.01990014846219923  -.017039641576411135
            "Greece"   "GRS434003000(P)"   .004434597067866086  -.004434597067866086                     0
            "Italy"    "IT0001233417(P)"  -.021748742858796355  -.011466137087644324   .005749502491261271
            "Ireland"  "NL0000687663(P)"   -.03709551730454841 -.0049850551889187855  -.028385078531186547
            "Italy"    "IT0001250932(P)"   -.01636068948903624   .005760058543337276  -.012359858039678207
            "Spain"    "ES0178165017(P)"  -.005267388796204919   -.03338701603273719   -.00810493113735511
            "Italy"    "IT0001137345(P)"  -.015574164670079549   -.01671348097374059  -.049045288623402516
            "Ireland"  "IE00BLS09M33(P)"   -.01826402413590289    -.0014639147688289   -.03457870583497602
            "Spain"    "ES0142090317(P)"  -.023281956478969246  -.013419265393390223  -.026936419955439828
            "Italy"    "IT0005218380(P)"  -.008611450614287364   -.02152175951423807   -.00819115664292358
            "Spain"    "ES0143416115(P)"  -.032091218239867825  -.013981781173705077  -.035664397572136686
            "Spain"    "ES0109067019(P)"                     .                     .                     .
            "Italy"    "IT0001415246(P)"                     .                     .                     .
            "Italy"    "IT0005218752(P)"  -.011608852908567613   -.01801789236635898  -.028370978776942835
            "Spain"    "ES0116920333(P)"   -.02072841581090845 -.0017841217935017362   -.02898753687325195
            "Spain"    "ES0171996087(P)"  -.013072650565759014   -.05332997612478141   -.02599859309842678
            "Spain"    "ES0132105018(P)"   -.00416778363926662  -.012608598129143278  -.018294682839804288
            "Greece"   "GRS260333000(P)"   .007905179507113669  -.015873349156290573                     0
            "Spain"    "ES0175438003(P)"   .011004798242109204  -.012235062904150329  -.015299037289169481
            "Ireland"  "IE00BDB6Q211(P)"  -.050781407925708955   .009102577026902203  -.001373297467265111
            "Ireland"  "IE00BJ3V9050(P)"  -.006772034909944491   .007146917763444449 -.0011250704355689756
            "Spain"    "ES0105046009(P)"                     .                     .                     .
            "Italy"    "IT0003874101(P)"                     .                     .                     .
            "Italy"    "IT0001063210(P)"   -.01900044553036384   -.00816429256220319  -.014231652699739694
            "Spain"    "ES0113307021(P)"                     .                     .                     .
            "Italy"    "IT0003027817(P)"   .002949564619980749   .007745305501095534  -.011679994819010053
            "Ireland"  "IE00BBGT3753(P)"                     .                     .                     .
            "Ireland"  "IE0030606259(P)"   .018340654349338736  .0018309434471093233  -.004583659667658058
            "Ireland"  "IE00B1HDWM43(P)"                     0    .03333642026759187  -.008230499136515523
            "Ireland"  "IE0004927939(P)"    .03419136474827944   .029168926316883947  -.002451537978170659
            "Spain"    "ES0113790226(P)"  -.004086642385451977  -.009463144060622764  -.022999132084038365
            "Italy"    "IT0003487029(P)"  -.009079409291652407  -.016226749044165434  -.005463796561374412
            "Italy"    "IT0003261069(P)"  -.018456084820910545                     0   -.05646661166777123
            "Spain"    "ES0105630315(P)"  .0013783599701213678   .006863444924982476   -.04906379941535888
            "Spain"    "ES0182870214(P)"  -.055256647558235894     .0664729270688893   -.09345328484756887
            "Ireland"  "IE00BYSZ9G33(P)"  -.005182192776114647  -.008373648540358047  .0022613504181290267
            "Ireland"  "IE00B00MZ448(P)" -.0028019985959932825  -.025186496108618783       .04402290051266
            "Ireland"  "IE0000669501(P)"  -.030636969461889763    .01104983618658495    .03243527575315386
            "Italy"    "IT0001207098(P)"  -.014154517987391202   .014154517987391202 -.0070522154053245245
            "Italy"    "IT0003850929(P)"  -.015193242724775402 -.0018387991696569017   -.03369002338298355
            "Spain"    "ES0118594417(P)"   -.02617379511391249  -.013908430046131848   -.03593200922606332
            "Italy"    "IT0001347308(P)"  -.016511693372310177  -.025565711138061165  -.033616610798985036
            "Italy"    "IT0000070786(P)"  -.014706147389695473  .0036968618813261467  -.022388994893478717
            "Italy"    "IT0000080447(P)"  -.010875045388875404   .007920833491443902  -.030032287098875066
            "Italy"    "IT0000076502(P)"  -.023119689834454782  -.026113669546393048   -.05591988091091382
            "Ireland"  "IE00BGH1M568(P)"   -.02927321035041297  .0011757790890118969  -.030120064302475047
            end

            Comment


            • #7
              Well, I can convert this almost to panel data easily enough:

              Code:
              rename Date* delta_log_price*
              reshape long delta_log_price, i(Country Code) j(date) string
              But to really make it a panel, the variable date has to be converted to a Stata internal format date variable. But I can't figure out what dates these seven digit numbers represent, so I don't know how to tell Stata to parse them. What date, for example, does "0403108" represent? There is no April 31. There is no 31st month. I can't think of any year that you would write as 108. So if you can explain how these "dates" work, perhaps we can finish the task at hand.

              Comment


              • #8
                Code:
                * Example generated by -dataex-. To install: ssc install dataex
                clear
                input str8 Country str15 Code double(Date020108 Date030108 Date040108)
                "Italy"    "IT0003128367(P)"  -.007404279020984061   .014754137393018008  -.011668191416815299
                "Italy"    "IT0000062072(P)"   -.01396611294767558  -.001310649639955308 -.0032824503837054486
                "Italy"    "IT0003132476(P)" -.0019980026626731373    .01547957084838636  -.008702586569362403
                "Spain"    "ES0178430E18(P)"  -.010858341795213722  -.020222875787938133  -.006052961771064513
                "Spain"    "ES0113900J37(P)"  -.013607956802442533   -.00964270336012163  -.014640669501002623
                "Spain"    "ES0173516115(P)"   .013039316382324806   .006858420237372265  -.010918878931014842
                "Ireland"  "IE00BY7QL619(P)"    -.0116650402955609  -.016468429354995706   -.01253035547131276
                "Ireland"  "IE00B4BNMY34(P)"  .0008322930151694052  -.017343092038290653    -.0150678046199357
                "Spain"    "ES0167050915(P)"  -.013620754632633236   -.02653359411472911   -.05392575025441948
                "Spain"    "ES0144580Y14(P)"  -.024329655735718214   .008824139769920913   .012608486233243177
                "Italy"    "IT0003796171(P)"                     .                     .                     .
                "Ireland"  "IE00BTN1Y115(P)"  -.015435808129839135   .005037794029957077  -.011523426816555382
                "Ireland"  "IE0001827041(P)"    .02243422443622567    .04078377896815777   .008090870184118693
                "Spain"    "ES0113211835(P)"  -.010799650246881232  -.008481111925456197  -.020893324672861535
                "Spain"    "ES0148396007(P)"  .0035633723416141905   -.02351355931047916   -.07013804885430819
                "Spain"    "ES0116870314(P)"  -.015107353310698013   .006573809250873808  -.047743832290300325
                "Spain"    "ES0177542018(P)"                     .                     .                     .
                "Italy"    "IT0003497168(P)"  -.013025643017155919  -.011990551331911181  -.015805800171188045
                "Spain"    "ES0130670112(P)"  -.026768958438936785  .0025391924893378715   .003377844168883204
                "Ireland"  "IE00B8KQN827(P)"   -.03452417793326523   .026550232094120663   -.04312936089703179
                "Italy"    "IT0005239360(P)"  -.021352698033515694   .006275107234383626   -.02442476482851319
                "Italy"    "IT0000072618(P)"  -.020538638889513683  .0028330350615715094   -.00756588227884758
                "Italy"    "IT0004810054(P)"  -.010671212362686866   -.01950336902773797   -.03224384964809346
                "Portugal" "PTEDP0AM0009(P)"  -.004484312447328831   .013393057336438252   .006629858538669486
                "Portugal" "PTJMT0AE0001(P)"   .016529301951210496 -.0018231545615150502   .019874186207083477
                "Ireland"  "IE0002424939(P)"   .010196462963471653    .01828423809414481   .016256774360305926
                "Ireland"  "IE00BY9D5467(P)"  -.009626138751773983  -.004848042312933565   -.02536573628356331
                "Portugal" "PTGAL0AM0009(P)"  -.010385444533480115  -.019418085857101364   -.05232581900173994
                "Ireland"  "IE00B6330302(P)"   -.03436751153187512  -.013905288064114618   -.03844475586519103
                "Italy"    "IT0003856405(P)"  -.012826993446154233  -.006008650342403499  -.015899479124151128
                "Italy"    "IT0004827447(P)" -.0074754358607971305  -.020938636987073433  -.014330265522652486
                "Spain"    "ES0118900010(P)"  -.032526086113981556   .004711859069967517   -.03767444892031202
                "Ireland"  "IE00B58JVZ52(P)"   -.04245731786098572  .0028600632366266865  -.050198744492355285
                "Spain"    "ES0105027009(P)"                     .                     .                     .
                "Italy"    "IT0000068525(P)"  -.012842437627802905   .030548061004342486  -.020260369820762403
                "Italy"    "IT0001479374(P)"  -.027513976200776114  -.028778964550043362  -.017178336535084604
                "Spain"    "ES0126775032(P)"                     .                     .                     .
                "Spain"    "ES0140609019(P)"   .005789739414386874  -.019422477102422064                     0
                "Ireland"  "IE00B1RR8406(P)"   .014369592650391283  -.008845701198826106   .008405269568716012
                "Italy"    "IT0004176001(P)"  -.044801681151043216  -.007458083047203967   -.06841376818992462
                "Ireland"  "IE00BYTBXV33(P)"  -.008646832949723793  -.059485453286179935   -.04356191980490198
                "Italy"    "IT0000433307(P)"   .015600940442479727 -.0012391575315482406   -.03340997788162592
                "Greece"   "GRS298343005(P)"   .010582109330536937   -.01591545530589933   .022908490796869962
                "Italy"    "IT0003826473(P)"  -.006598754315198185   -.02877804698037356  -.018674231915709938
                "Spain"    "ES0125220311(P)"   -.03711088138745122   .009526149676423401   -.03448201778172333
                "Greece"   "GRS426003000(P)"   .020785193466077434                     0  -.008663832933732518
                "Italy"    "IT0003506190(P)"   -.01202777531442889  -.003911578082657741  -.020586873117423465
                "Spain"    "ES0122060314(P)"   -.01568836389459438  -.030294439386866046   -.05743491852019966
                "Ireland"  "IE0004906560(P)"    .02052523594473099   .004504512121104476  -.006764400088542288
                "Portugal" "PTSON0AM0001(P)"  -.015314234973042629  -.020732414695754597   -.03787948777217709
                "Spain"    "ES0113860A34(P)"  -.013596216797447491  -.024914264607664327   -.02989963383704697
                "Italy"    "IT0003865570(P)"  -.028519199795812966  -.013468217050866649   -.04560034181223571
                "Spain"    "ES0111845014(P)" -.0022690287444326884  -.020677930897552432   -.00746029354101907
                "Ireland"  "IE00BLNN3691(P)"     .0336828688742119  .0007044734352636972   -.03191227370957028
                "Italy"    "IT0000784154(P)"   .008318263515894486   -.01990014846219923  -.017039641576411135
                "Greece"   "GRS434003000(P)"   .004434597067866086  -.004434597067866086                     0
                "Italy"    "IT0001233417(P)"  -.021748742858796355  -.011466137087644324   .005749502491261271
                "Ireland"  "NL0000687663(P)"   -.03709551730454841 -.0049850551889187855  -.028385078531186547
                "Italy"    "IT0001250932(P)"   -.01636068948903624   .005760058543337276  -.012359858039678207
                "Spain"    "ES0178165017(P)"  -.005267388796204919   -.03338701603273719   -.00810493113735511
                "Italy"    "IT0001137345(P)"  -.015574164670079549   -.01671348097374059  -.049045288623402516
                "Ireland"  "IE00BLS09M33(P)"   -.01826402413590289    -.0014639147688289   -.03457870583497602
                "Spain"    "ES0142090317(P)"  -.023281956478969246  -.013419265393390223  -.026936419955439828
                "Italy"    "IT0005218380(P)"  -.008611450614287364   -.02152175951423807   -.00819115664292358
                "Spain"    "ES0143416115(P)"  -.032091218239867825  -.013981781173705077  -.035664397572136686
                "Spain"    "ES0109067019(P)"                     .                     .                     .
                "Italy"    "IT0001415246(P)"                     .                     .                     .
                "Italy"    "IT0005218752(P)"  -.011608852908567613   -.01801789236635898  -.028370978776942835
                "Spain"    "ES0116920333(P)"   -.02072841581090845 -.0017841217935017362   -.02898753687325195
                "Spain"    "ES0171996087(P)"  -.013072650565759014   -.05332997612478141   -.02599859309842678
                "Spain"    "ES0132105018(P)"   -.00416778363926662  -.012608598129143278  -.018294682839804288
                "Greece"   "GRS260333000(P)"   .007905179507113669  -.015873349156290573                     0
                "Spain"    "ES0175438003(P)"   .011004798242109204  -.012235062904150329  -.015299037289169481
                "Ireland"  "IE00BDB6Q211(P)"  -.050781407925708955   .009102577026902203  -.001373297467265111
                "Ireland"  "IE00BJ3V9050(P)"  -.006772034909944491   .007146917763444449 -.0011250704355689756
                "Spain"    "ES0105046009(P)"                     .                     .                     .
                "Italy"    "IT0003874101(P)"                     .                     .                     .
                "Italy"    "IT0001063210(P)"   -.01900044553036384   -.00816429256220319  -.014231652699739694
                "Spain"    "ES0113307021(P)"                     .                     .                     .
                "Italy"    "IT0003027817(P)"   .002949564619980749   .007745305501095534  -.011679994819010053
                "Ireland"  "IE00BBGT3753(P)"                     .                     .                     .
                "Ireland"  "IE0030606259(P)"   .018340654349338736  .0018309434471093233  -.004583659667658058
                "Ireland"  "IE00B1HDWM43(P)"                     0    .03333642026759187  -.008230499136515523
                "Ireland"  "IE0004927939(P)"    .03419136474827944   .029168926316883947  -.002451537978170659
                "Spain"    "ES0113790226(P)"  -.004086642385451977  -.009463144060622764  -.022999132084038365
                "Italy"    "IT0003487029(P)"  -.009079409291652407  -.016226749044165434  -.005463796561374412
                "Italy"    "IT0003261069(P)"  -.018456084820910545                     0   -.05646661166777123
                "Spain"    "ES0105630315(P)"  .0013783599701213678   .006863444924982476   -.04906379941535888
                "Spain"    "ES0182870214(P)"  -.055256647558235894     .0664729270688893   -.09345328484756887
                "Ireland"  "IE00BYSZ9G33(P)"  -.005182192776114647  -.008373648540358047  .0022613504181290267
                "Ireland"  "IE00B00MZ448(P)" -.0028019985959932825  -.025186496108618783       .04402290051266
                "Ireland"  "IE0000669501(P)"  -.030636969461889763    .01104983618658495    .03243527575315386
                "Italy"    "IT0001207098(P)"  -.014154517987391202   .014154517987391202 -.0070522154053245245
                "Italy"    "IT0003850929(P)"  -.015193242724775402 -.0018387991696569017   -.03369002338298355
                "Spain"    "ES0118594417(P)"   -.02617379511391249  -.013908430046131848   -.03593200922606332
                "Italy"    "IT0001347308(P)"  -.016511693372310177  -.025565711138061165  -.033616610798985036
                "Italy"    "IT0000070786(P)"  -.014706147389695473  .0036968618813261467  -.022388994893478717
                "Italy"    "IT0000080447(P)"  -.010875045388875404   .007920833491443902  -.030032287098875066
                "Italy"    "IT0000076502(P)"  -.023119689834454782  -.026113669546393048   -.05591988091091382
                "Ireland"  "IE00BGH1M568(P)"   -.02927321035041297  .0011757790890118969  -.030120064302475047
                end

                Hi, I posted again the example because indeed there was a "problem" with the dates. My apologies for that.

                Comment


                • #9
                  So, with the data in #8, the following will get you into long layout panel data:

                  Code:
                  rename Date* delta_log_price*
                  reshape long delta_log_price, i(Country Code) j(str_date) string
                  
                  gen date = date(str_date, "MD20Y")
                  format date %td
                  drop str_date
                  Now, I may have handled the dates incorrectly. Your dates are comprehensible this time, but they are ambiguous. I cannot tell if 020108 is supposed to represent the second day of January 2008 or the first day of February 2008. All of the example dates can be interpreted either way. The code above assumes that it's February 1, 2008. But if you are listing the day before the month, then change "MD20Y" to "DM20Y" to get correct dates.

                  Comment

                  Working...
                  X