Announcement

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

  • Year Index

    Hi,

    I have a panel data from 2003-2018. I have taken the average of (Top Marginal Income Tax from 2003-2010 and 2011-2018). and then sorted it by year.

    egen mean_MIT_03_10 = mean(MIT) if year>=2003 & year<2011, by (Region_Name)
    egen mean_MIT_11_18 = mean(MIT) if year>=2011 & year<2019, by (Region_Name)
    sort year

    I now want to create a year index from 2003-2010 and 2011-2018. So that I can create the following graph:

    Can anyone please help me? If there is any more calcification you need, please let me know. Thank you.
    Attached Files

  • #2
    The equivalent in Stata to this beast from the R universe would just be something like a line plot against the x variable (which isn't mentioned in your code) using the by() option.

    Comment


    • #3
      Hi,

      So I was able create this graph in STATA but how can I align it vertically?

      Code:

      grstyle init
      grstyle set plain, horizontal grid
      #delimit ;
      twoway (line mean_MIT_yearGroup YearGroup),
      by (Region_Name) xlabel(0(1)1);
      #delimit cr
      Attached Files

      Comment


      • #4
        You may select the number of columns to be 1.
        Best regards,

        Marcos

        Comment


        • #5
          Where in the code? Thanks!

          Comment


          • #6
            try to add - cols(1) - in the end of the code.
            Best regards,

            Marcos

            Comment


            • #7
              It gives me error:

              option cols() not allowed

              Comment


              • #8
                To get a code which can be immediately applied to one's data, one is supposed to follow the FAQ advice.

                In spite of more than 2 dozen posts, in #1 and #3 we still see you weren't able to present data/command/output accordingly. In short, under code delimiters.

                Without following this very simple advice, forum members who wish to give you a specific reply would oftentimes need: a) to download data so as to work on; b) to type verbatim the commands you used; c) to fiddle with them so as to reach the desired solution.

                Therefore, generally speaking, if one declines to follow the FAQ advice, we assume one just wants a "general" tip, not a specific code.

                But it seems you do wish a specific code, not a tip.

                On these grounds, please do follow the FAQ advice in the forthcoming posts. Thanks.

                That being said, the advice I gave in #4 and #6 relates to adding the afore mentioned option within - by -, after a comma, adding extra parenthesis.

                Being more clear, you may type something like:

                Code:
                 by(Region_Name, cols(1))
                Hopefully that helps.
                Last edited by Marcos Almeida; 10 May 2019, 05:06.
                Best regards,

                Marcos

                Comment


                • #9
                  ok

                  Comment

                  Working...
                  X