Announcement

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

  • Finding minimum value out of 5 different variables for each row

    I would like to create a new variable that equals the minimum value out of 5 different variables for each row.

    Example: For each "ID" would like to find the minimum value out of v1,v2,v3,v4,v5 and create a new variable "v6" using that value

    ID v1 v2 v3 v4 v5
    1 22 25 28 30 11
    2 15 28 14 19 29

    Update: Realized this works, sorry for the wasted post!

    egen v6=rowmin( v1 v2 v3 V4 V5)
    Last edited by Jasleen Kaur; 31 Dec 2020, 00:06.

  • #2
    Also, see here https://www.statalist.org/forums/for...-maximum-value for advice on dealing with cases where two or more variables are tied.

    Comment

    Working...
    X