Announcement

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

  • Creating panel for quarterly data for multiple years

    Hiee everyone.I am working on a macro project where i have 7 macro variables for 20 countries from 2006 to 2016.it is a quarterly data in the form of 2006Q1,2006Q2,..,2006Q4 to 2016Q2.
    I run few commands to generate a panel data.the commands are as follows:
    encode country, generate(countryid)

    generate quarter2=quarter+tq(2006q1)-1

    format quarter2 %tq

    xtset countryid quarter2

    After running them,the error 451 arises which says repeated values within panel.
    Can anyone please suggest me to how to create a panel data for my data set so that my data is more of a readable form where time variable is explained as 2006Q1 to 2016Q2

  • #2

    Code:
    duplicates report countryid quarter2
    http://www.stata.com/support/faqs/da...d-time-values/

    Comment


    • #3
      Thank you sir.
      But it didnt solve my problem.my countries are still taking the values as: 2006Q1,2006Q2,2006Q3 and 2006Q4 for all the countries and for all the years.

      Comment


      • #4
        Please show us a data example to make clear what you are doing.
        Please read and act on http://www.statalist.org/forums/help#stata

        In particular, we need to understand what is happening with

        Code:
        generate quarter2=quarter+tq(2006q1)-1
        Minimally, show us the result of

        Code:
        describe quarter 
        summarize quarter 
        tab quarter

        Comment


        • #5
          This shouldn't be in Sandbox. Please post your next question in General.

          Comment


          • #6
            these are my data sets.i have attached both the original data set and the one with the codes which i run.
            Attached Files

            Comment


            • #7
              If you read the link that I requested you to read in #4 you will see that spreadsheet files are not a good idea here. This is a Stata forum, not an Excel forum.

              Comment

              Working...
              X