Announcement

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

  • Fillin with incomplete data

    Hello,

    I want to use fillin to complete my data but i have missing categories in my group variable.

    I have this :

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(id group)
    1 1
    1 2
    1 4
    1 5
    2 1
    2 2
    2 5
    end
    In my data there is only 1 2 4 5 for the variable group. But i want something like that (with the value 3 in group) :

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(id group)
    1 1
    1 2
    1 3
    1 4
    1 5
    2 1
    2 2
    2 3
    2 4
    2 5
    end
    Is it possible to get that with Fillin ? Or an other solution ?

    Thanks !

  • #2
    This is discussed in

    Code:
    SJ-5-1  dm0011  . . . . . . . . . . . . . .  Stata tip 17: Filling in the gaps
            . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
            Q1/05   SJ 5(1):135--136                                 (no commands)
            tips for using fillin to fill in gaps in a rectangular
            data structure
    which in turn is referenced in the manual entry for fillin.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(id group)
    1 1
    1 2
    1 4
    1 5
    2 1
    2 2
    2 5
    end
    
    expand 2 in L 
    replace group = 3 in L 
    
    fillin id group
    
    list

    Comment

    Working...
    X