Announcement

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

  • twoway connected

    County Country_code Region_Name Income MIT2003 MIT2004 MIT2005 mean_MIT2003 mean_2004 mean_2005

    Aruba ABW Latin America & the Carribean High 60.6 58.5 62.5
    Afghanistan AFG South Asia Low 20 20 20.5

    So above is my data set in this form. I have data on marginal tax rate for a couple of years by country. I created a mean variable by region for all the years ( for e.g. mean_MIT2003).
    I want to put the data in the following way:
    Reg_Name 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018
    East Asia & Pacific 36.967 36.333 36.2 36 35.667 35.6 34.8 34.567 34.4 34.6 31.324 31.324 29.886 30.682 30.787 30.247
    Europe & Central Asia 37.17 35.879 34.855 34.956 34.151 32.984 32.526 32.988 32.895 33.277 31.883 32.117 31.661 31.807 32.408 32.28
    Latin America & The Caribbean 26.445 26.386 26.062 26.004 27.085 27.615 27.747 28.303 27.747 28.392 27.776 27.776 27.933 27.878 28.391 28.732
    Middle East & North Africa 14.917 15.25 15.25 15.25 14 13.917 13.833 13.917 12.583 12.833 16.933 16.933 16.933 16.813 17.031 17.031
    North America 21.333 21.333 21.333 21.333 21.333 21.333 21.333 21.333 21.333 21.333 22.867 22.867 22.867 24.2 24.2 23.333
    South Asia 25 25 26.25 26.25 23.75 23.75 23.75 23.75 23.75 23.75 24.598 25.598 25.598 24.108 24.308 25.976
    Sub - Saharan Africa 29.817 29.817 29.244 28.672 29.27 27.881 26.805 27.005 26.732 28.696 31.059 31 31.361 31.079 31.524 31.286
    So that I can create a twoway connected graph as attached.

    Should I reshape the data? Can someone help please. Thank you.


    Attached Files

  • #2
    As far as I can understand it, your present data layout is not good for what you want, as you know, but you don't want to get to the data layout you outline either.

    Let me repeat advice given to you in three previous threads you started.

    https://www.statalist.org/forums/for...query-in-stata

    https://www.statalist.org/forums/for...wer-thresholds

    https://www.statalist.org/forums/for...-the-bar-graph

    To give good advice, we need to see a data example, and we need to see an example in a way we ourselves can copy and paste into Stata. That means using dataex.

    Here's the important advice all at one place. https://www.statalist.org/forums/help#stata

    Comment


    • #3
      Country Country_Code Region_Name Income MIT2003 MIT2004 MIT2005 MIT2006 MIT2007 MIT2008 MIT2009 MIT2010 MIT2011 MIT2012 MIT2013 MIT2014 MIT2015 MIT2016 MIT2017 MIT2018 mean_MIT_03 mean_MIT_04 mean_MIT_05 mean_MIT_06 mean_MIT_07 mean_MIT_08 mean_MIT_09 mean_MIT_10 mean_MIT_11 mean_MIT_12 mean_MIT_13 mean_MIT_14 mean_MIT_15 mean_MIT_16 mean_MIT_17 mean_MIT_18
      Aruba ABW Latin America & The Caribbean High 60.06 60.06 60.06 60.06 58.95 58.95 58.95 58.95 58.95 58.95 58.95 58.95 58.95 58.95 58.95 59 28.0975 28.035 27.69125 27.62875 28.77813 29.34063 29.37941 29.96765 29.37941 29.96944 28.20227 28.20227 28.42955 28.36136 29.0413 29.41304
      Afghanistan AFG South Asia Low Income 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 25 25 26.25 26.25 23.75 23.75 23.75 23.75 23.75 23.75 24.598 25.598 25.598 24.108 24.308 25.976
      Angola AGO Sub-Saharan Africa Upper-Middle Income 15 15 15 15 15 15 15 17 17 17 17 17 17 17 17 17 30.41875 30.41875 29.775 29.13125 29.80375 28.24125 27.00556 27.22778 26.905 29.03182 31.4375 31.35294 31.73529 31.41667 31.85 31.6
      Albania ALB Europe and Central Asia Upper-Middle Income 25 10 10 10 10 10 10 23 23 23 23 23 37.49429 36.12886 35.04629 35.23111 34.42892 33.19316 32.71105 33.14579 33.04763 33.44895 31.97463 32.21762 31.74048 31.89286 32.52214 32.38833
      United Arab Emirates ARE Middle East & North Africa High 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 14.91667 15.25 15.25 15.25 14 13.91667 13.83333 13.91667 12.58333 12.83333 16.93333 16.93333 16.93333 16.8125 17.03125 17.03125
      Argentina ARG Latin America & The Caribbean Upper-Middle Income 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 28.0975 28.035 27.69125 27.62875 28.77813 29.34063 29.37941 29.96765 29.37941 29.96944 28.20227 28.20227 28.42955 28.36136 29.0413 29.41304
      Armenia ARM Europe and Central Asia Lower-Middle Income 20 20 20 20 20 20 20 20 20 25 25 36 36 36 36 36 37.49429 36.12886 35.04629 35.23111 34.42892 33.19316 32.71105 33.14579 33.04763 33.44895 31.97463 32.21762 31.74048 31.89286 32.52214 32.38833
      Antigua and Barbuda ATG Latin America & The Caribbean High 25 25 25 25 25 25 28.0975 28.035 27.69125 27.62875 28.77813 29.34063 29.37941 29.96765 29.37941 29.96944 28.20227 28.20227 28.42955 28.36136 29.0413 29.41304
      Australia AUS East Asia & Pacific High 47 47 47 47 45 45 45 45 45 45 45 45 45 45 45 45 36.75 36.07143 35.92857 35.71429 35.35714 35.28571 34.42857 34.17857 34 34.21429 30.81412 30.81412 29.04667 29.88611 29.99722 29.73421
      Austria AUT Europe and Central Asia High 50 50 50 50 50 50 50 50 50 50 50 50 50 55 55 55 37.49429 36.12886 35.04629 35.23111 34.42892 33.19316 32.71105 33.14579 33.04763 33.44895 31.97463 32.21762 31.74048 31.89286 32.52214 32.38833
      Belgium BEL Europe and Central Asia High 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 37.49429 36.12886 35.04629 35.23111 34.42892 33.19316 32.71105 33.14579 33.04763 33.44895 31.97463 32.21762 31.74048 31.89286 32.52214 32.38833
      Bangladesh BGD South Asia Lower-Middle Income 25 25 25 25 25 25 25 25 25 25 25 30 30 30 30 30 25 25 26.25 26.25 23.75 23.75 23.75 23.75 23.75 23.75 24.598 25.598 25.598 24.108 24.308 25.976
      Bulgaria BGR Europe and Central Asia Upper-Middle Income 29 29 24 24 24 10 10 10 10 10 10 10 10 10 10 10 37.49429 36.12886 35.04629 35.23111 34.42892 33.19316 32.71105 33.14579 33.04763 33.44895 31.97463 32.21762 31.74048 31.89286 32.52214 32.38833
      Bahrain BHR Middle East & North Africa High 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 14.91667 15.25 15.25 15.25 14 13.91667 13.83333 13.91667 12.58333 12.83333 16.93333 16.93333 16.93333 16.8125 17.03125 17.03125
      Bahamas BHS Latin America & The Caribbean High 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28.0975 28.035 27.69125 27.62875 28.77813 29.34063 29.37941 29.96765 29.37941 29.96944 28.20227 28.20227 28.42955 28.36136 29.0413 29.41304
      Bosnia and Herzegovina BIH Europe and Central Asia Upper-Middle Income 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 37.49429 36.12886 35.04629 35.23111 34.42892 33.19316 32.71105 33.14579 33.04763 33.44895 31.97463 32.21762 31.74048 31.89286 32.52214 32.38833
      Belarus BLR Europe and Central Asia Upper-Middle Income 12 12 13 13 13 13 37.49429 36.12886 35.04629 35.23111 34.42892 33.19316 32.71105 33.14579 33.04763 33.44895 31.97463 32.21762 31.74048 31.89286 32.52214 32.38833
      Brazil BRA Latin America & The Caribbean Upper-Middle Income 27.5 27.5 27.5 27.5 27.5 27.5 27.5 27.5 27.5 27.5 27.5 27.5 27.5 27.5 27.5 27.5 28.0975 28.035 27.69125 27.62875 28.77813 29.34063 29.37941 29.96765 29.37941 29.96944 28.20227 28.20227 28.42955 28.36136 29.0413 29.41304
      Barbados BRB Latin America & The Caribbean High 35 35 35 35 33.5 33.5 40 28.0975 28.035 27.69125 27.62875 28.77813 29.34063 29.37941 29.96765 29.37941 29.96944 28.20227 28.20227 28.42955 28.36136 29.0413 29.41304
      Brunei Darussalam BRN East Asia & Pacific High 0 0 0 0 36.75 36.07143 35.92857 35.71429 35.35714 35.28571 34.42857 34.17857 34 34.21429 30.81412 30.81412 29.04667 29.88611 29.99722 29.73421
      Canada CAN North America High 29 29 29 29 29 29 29 29 29 29 29 29 29 33 33 33 32 32 32 32 32 32 32 32 32 32 34.3 34.3 34.3 36.3 36.3 35

      Comment


      • #4
        Sorry, no; that is not using dataex.

        Comment


        • #5
          I have attached the data in excel.
          Attached Files

          Comment


          • #6
            The link in #2 explains why spreadsheet attachments are really not a good idea either.


            Last edited by Nick Cox; 02 May 2019, 10:39.

            Comment

            Working...
            X