Announcement

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

  • Generating a new variable to store the lowest value from 4 other variables

    Hello, I was wondering how I could create a separate variable that would store the minimum value for Mal 46, Mal66, Mal 82 and Mal94 for each country.

    +-----------------------------------------------------------+
    | country Mal46 Mal66 Mal82 Mal94 |
    |-----------------------------------------------------------|
    1. | China .3545142 .5277874 .2203141 .062014 |
    2. | India .966967 .3763701 .9326267 .7924091 |
    3. | Indonesia 1 .911973 .9325598 .9252614 |
    4. | Brazil .9914606 .8933585 .7526364 .4297798 |
    5. | Russia .0674032 0 0 0

  • #2

    Code:
    help egen
    
    egen wanted = rowmin(Mal??)
    Last edited by Nick Cox; 13 Nov 2022, 08:00.

    Comment


    • #3
      Code:
      egen min=rowmin(Mal46 Mal66 Mal82  Mal94)
      for more on this command, which has lots of very helpful functions, see
      Code:
      he egen

      Comment

      Working...
      X