Announcement

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

  • Filling in observations with a 0 in missing month

    Hello,

    I would to fill up for some non existing count in my dataset.

    for example real_month is was 0 for EventRootCode 15. I wanted to nevertheless have an observation for real_month 409 , that is 0. ( similar for real_month 411)

    . dataex

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float real_month str2 EventRootCode long monthly_ERC_count double monthly_ERC_event_total
    408 "15"  1  1
    410 "15"  1  1
    412 "15"  2  4
    413 "15"  1  1
    414 "15"  1  1
    415 "15"  3  4
    417 "15"  9 13
    418 "15"  2  3
    420 "15"  1  1
    422 "15"  1  2
    423 "15"  2  6
    425 "15"  9 13
    426 "15"  4  5
    427 "15"  2  4
    428 "15"  1  2
    429 "15"  1  1
    430 "15"  3  3
    431 "15"  2  3
    433 "15"  1  3
    434 "15"  2  4
    435 "15"  1  1
    436 "15"  1  2
    437 "15"  2  2
    438 "15"  2  3
    439 "15"  1  2
    440 "15"  8 18
    441 "15"  1  2
    442 "15"  4  4
    444 "15"  4  5
    445 "15"  2  3
    447 "15"  2  3
    448 "15" 10 16
    449 "15"  2  4
    451 "15"  1  1
    452 "15"  2  3
    453 "15"  1  1
    454 "15"  5  7
    455 "15"  3  5
    457 "15"  5 10
    458 "15"  1  1
    459 "15"  3  5
    460 "15"  1  2
    463 "15"  2  3
    464 "15"  1  1
    465 "15"  4  7
    466 "15"  2  2
    467 "15"  2  2
    468 "15"  8 12
    469 "15"  8 10
    470 "15"  2  4
    471 "15"  4  6
    472 "15" 10 14
    473 "15" 14 21
    474 "15"  2  3
    476 "15" 12 17
    477 "15"  5  5
    478 "15"  1  1
    479 "15"  2  3
    480 "15"  3  4
    481 "15"  6  8
    482 "15"  2  3
    483 "15"  1  2
    484 "15"  7 13
    485 "15"  5  6
    486 "15"  3  4
    487 "15"  3  4
    488 "15"  5  9
    489 "15" 12 16
    490 "15" 10 16
    491 "15" 11 22
    492 "15"  5  7
    493 "15"  5 10
    494 "15"  7 14
    495 "15"  6 11
    496 "15"  4  7
    497 "15"  3  4
    498 "15"  7  9
    499 "15"  6  8
    500 "15" 12 20
    501 "15" 17 23
    502 "15" 17 27
    503 "15" 10 23
    504 "15"  8 13
    505 "15"  8 11
    506 "15"  4  5
    507 "15"  9 13
    508 "15"  6 11
    509 "15"  3  6
    510 "15"  7 10
    511 "15"  5  9
    512 "15"  5  9
    513 "15"  6  8
    514 "15" 11 17
    515 "15" 11 15
    516 "15" 28 51
    517 "15" 23 32
    518 "15" 31 53
    519 "15"  9 10
    520 "15"  6  9
    521 "15"  8 15
    end
    format %tm real_month
    ------------------ copy up to and including the previous line ------------------

    Listed 100 out of 458 observations
    Use the count() option to list more

    I thought using the fillin command would be a good option here.

    fillin real_month
    . gives " too few variables specified"


  • #2
    The tsfill command is proably what you have in mind.

    Comment


    • #3
      Moment of weakness yesterday. thank you William

      yes ofcourse.

      for everyone problems with these topics.

      Stata has a solid youtube channel that covers basics to freshen up skills.

      https://www.youtube.com/watch?v=SOQvXICIRNY

      Comment

      Working...
      X