Announcement

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

  • Creating a New Variable Dependent on Maximum Value

    [CODE]
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(VOCATfemale_equiv ACADEMfemale) str7 MCSID
    0 1 "M10016V"
    0 0 "M10044Z"
    . 4 "M10062B"
    1 2 "M10068H"
    0 2 "M10083G"
    3 3 "M10134A"
    5 5 "M10146E"
    0 1 "M10153D"
    0 2 "M10195P"
    2 1 "M10313B"
    5 2 "M10349P"
    0 1 "M10379V"
    0 0 "M10455Q"
    0 0 "M10492V"
    0 0 "M10537R"
    0 2 "M10541M"
    0 2 "M10567X"
    5 2 "M10603J"
    0 0 "M10614M"
    3 2 "M10617Q"
    5 5 "M10620K"
    1 0 "M10639W"

    I am trying to create a new variable to represent the highest level of academic achievement. This new variable will be the higher value of either VOCATfemale_equiv or ACADEMfemale. MCSID is just the identifier variable. Would appreciate some advice, thanks you, J Rea

  • #2

    Code:
    gen wanted = max(VOCATfemale_equiv,  ACADEMfemale)
    https://www.stata-journal.com/articl...article=dm0058 is a personal rapid bus tour of some valuable functions.
    Last edited by Nick Cox; 12 May 2022, 08:37.

    Comment


    • #3
      Many thanks, much appreciated, J Rea

      Comment

      Working...
      X