Announcement

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

  • three dimensional panel analysis

    I also am doing three dimensional panel analysis- country, industry,year.

    i=country, 10
    j=industry, 10
    t=year, 12

    How can a treat this data as panel data?

    When i use tsset comand i have this mensage:

    . tsset id period
    repeated time values within panel
    r(451);

    end of do-file

    r(451);


  • #2
    Can you do

    Code:
    egen idcode = group(country industry)
    xtset idcode period
    The egen command will create a unique code for each observed combination of country and industry.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Thank you Richard Williams!

      I will try it!!

      Comment


      • #4
        Already tried and I got! thank you so much Richard Williams

        Comment


        • #5
          Situations like yours are fairly common, and it has always seemed odd to me that you can't specify more than one variable for the panel id. Depending on how your vars are coded, you might also be able to do something like

          Code:
          gen long idcode = country * 100 + indcode
          but you would need to make sure it actually worked right. The last two digits would identify the industry and the other digits would id the country. Adapt the code if the industry codes are not two digits, e.g. if industry codes are three digits then multiply country by 1000.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            Yes it will be useful if STATA allow that.
            I will try this suggestion to see what i can get!!

            Comment


            • #7
              I try and it works too!!

              Many thanks

              Comment


              • #8
                I kind of like my latter suggestion because the value of the idcode is not dependent on what countries and firms actually happen to be in the data set. But again you have to make sure that you code it right and that it works the way you want.
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                StataNow Version: 19.5 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://www3.nd.edu/~rwilliam

                Comment


                • #9
                  Hello,

                  I have the same issue and what able to solve it using
                  Code:
                   
                   egen idcode = group(country industry) xtset idcode period
                  However, now I want to calculate the lagged variable of a variable that is unique to country and industry. about 25% of the output in missing values even tough I have no missing values in my non-lagged data. Does anybody know a solution? Best regards

                  Comment


                  • #10
                    Ralph: Please don't post in two or more threads simultaneously unless they are about completely different questions.

                    If you have further questions on this, follow your other thread https://www.statalist.org/forums/for...nt-and-company

                    Comment

                    Working...
                    X