Announcement

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

  • using xtile command in panel setting

    I have a panel dataset of firms. Using this dataset, I am trying to create a new variable containing average values of an existing variable for top 1% or 5% of firms within industry and year.
    For example, in the attached dataset, I am trying create a variable containing the average value of tfp_re for the top 1% of firms by industry and year.
    Since the xtile command does not allow using "by", I wonder if there is a short cut to my problem.
    Attached Files
    gift

  • #2
    Code:
    bys ind_mid year: egen top = pctile(tfp_re), p(99)

    Comment


    • #3
      Beautiful! Thanx!
      gift

      Comment


      • #4
        I am trying to retrieve fitted values (xb) after a GMM regression of a Cobb Douglas production functiion, using the command gmm(lnvar-{b1}*lntar - {b2}*lnL - {b0}), instruments (L.lntar L2.lntar D.lntar L.lnL L2.lnL D.lnL).
        After the regression, command "predict name, xb" returns only single number! What has happened?
        gift

        Comment


        • #5
          I don't know. Can I see your example data using dataex?

          Comment


          • #6
            This is the example data
            Attached Files
            gift

            Comment


            • #7
              astile (available on the SSC) can be used with panel data. astile is blinking fast. See the following example using a panel data.

              Code:
              * Create 5 groups of firms based on their market value in each year 
              
              webuse grunfeld
              
              astile size5=mvalue, nq(5) by(year)
              I discuss several other example of astile on this page https://fintechprofessor.com/create-...-using-astile/
              Regards
              --------------------------------------------------
              Attaullah Shah, PhD.
              Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
              FinTechProfessor.com
              https://asdocx.com
              Check out my asdoc program, which sends outputs to MS Word.
              For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

              Comment

              Working...
              X