Announcement

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

  • Please help insert a column of year having max (ratio)

    Hello, I need your help.
    I have a panel data having corporate code, year and ratios.

    I would like to insert a year having maximum PPE/Asset ratio in the stated period sort by corporate code.
    Please please help me.


  • #2
    bysort corporatecode year: egen max = max(ratio)

    Comment


    • #3
      Please do follow the FAQ advice, particularly the recommendations about sharing data/command/output.
      Best regards,

      Marcos

      Comment


      • #4
        >>> Jesse,
        Thank you for your advise. If I want to insert a column of "year" of max (ratio), what should I do?

        >> Marcos,
        Thank you for your advise too.

        Comment


        • #5
          Originally posted by Yasutake Homma View Post
          >>> Jesse,
          Thank you for your advise. If I want to insert a column of "year" of max (ratio), what should I do?

          >> Marcos,
          Thank you for your advise too.
          Good that you are polite and you are thanking everybody, but you are not following the advice that Marcos gave you.

          I have no idea what you want, and apparently the shot that Jesse had at what you might want was a miss too.

          At this point you can keep on asking the vague question, and we can keep on having random shots at what you might possibly want (or maybe not, if we dont really feel like playing games today), or alternatively

          you can look up the help if -dataex-, provide a minimal example of how your data looks like, and then explain how you want the new variable to look like.

          Comment


          • #6
            I am very sorry for my question. I stop asking. I will post more concrete and detail question next time.

            Comment


            • #7
              Originally posted by Yasutake Homma View Post
              I am very sorry for my question. I stop asking. I will post more concrete and detail question next time.
              You keep on being polite but firm in your decision not to provide more information so that we can understand what you want.

              Is the following what you want (we can play guessing too if you prefer):

              Code:
              egen  maxratio = max(ratio), by(corporate_code)
              
              gen yearofmaxtemp = year if ratio==maxratio
              
              egen yearofmax = mean(yearofmaxtemp), by(corporate_code)
              
              drop yearofmaxtemp
              ?

              Comment


              • #8
                Hi Joro, I really appreciate the commands. I resolve my problems I had encountered. Thank you again.

                Comment

                Working...
                X