Announcement

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

  • Replacing missing data in columns

    Hi everyone,

    I am still learning how to use STATA and I am a bit stuck on how to replace the missing values from one column in another? Specifically, I want to replace the missing values in zhawhonew with the values in zhalwho. Any advice is greatly appreciated! Thank you!

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(zhawhonew zhalwho)
    . .
    3.965068 .
    . .
    . .
    . .
    . .
    -.7347254 .
    . 2.0785997
    . .
    .4341195 .
    -1.1188198 .
    -3.2490804 .
    -2.492729 .
    . .
    . .
    . -1.6943133
    . .
    1.3367217 .
    -1.3266315 .
    . .
    . -.6743155
    . -1.8566053
    -1.6187737 .
    . -1.4638957

  • #2
    You can do:

    Code:
    replace zhalwho = zhawonew if zhalwho == .

    Comment


    • #3
      Hi Jesse,

      Thank you for the quick response and your help! It worked!

      Comment

      Working...
      X