Announcement

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

  • Assigning pattern from misstable to individual rows

    Dear list,

    Is there a way to assign the missing pattern from the misstable command to the individual rows?

    I've introduced some missing values to the sysuse pop2000 data.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str10 agestr float(agegrp total white black indian asian island maletotal malewhite maleblack maleindian maleasian maleisland femtotal femwhite femblack femindian femasian femisland)
    "Under 5"   1 19175798 12859892 2804786 213052 670406 33391  9810733 6597764 1424275 108659 337149 17254  9365065 6262128 1380511 104393 333257 16137
    "5 to 9"    2 20549504 13944882 3205512 239007 680536 36503 10523277 7159656 1627475 120954 348856 18702        . 6785226 1578037 118053 331680 17801
    "10 to 14"  3 20528072 14322638 3121530      . 684525 35772 10520197 7361650 1584518 125260 352071 18376 10007875 6960988       .      . 332454 17396
    "15 to 19"  4 20219890 14167148 2929553      . 746511 37328 10391004 7288058 1482765 119350 380560 19394        . 6879090       . 113001 365951     .
    "20 to 24"  5 18964000 13064891 2628752      . 816452 38693  9687814 6675922 1280628      . 407865     .  9276187 6388969 1348124  95894 408587     .
    "25 to 29"  6        . 13501773 2548968      . 986222 35224  9798760 6846202 1211753  95441 484136 18385  9582576 6655571 1337215  91248 502086     .
    "30 to 34"  7        . 14818786 2618602      .      .     . 10321769 7490728 1239755  94245 461712 16883 10188619       . 1378847  91827 487706     .
    "35 to 39"  8 22706664 17031492 2826361 202013 909439 33031        . 8544270 1328309  99900 439179 16638 11387968 8487223       . 102113 470260 16393
    "40 to 44"  9        . 17265996 2700418 189201 846118 28760 11129102 8631912 1267177  92141 398480 14660 11312761 8634083 1433241  97060 447638 14100
    "45 to 49" 10 20092404        . 2275191 159422 749777 23675        . 7855623 1056143  77577 345873 11717 10202898 7955003 1219048      . 403904 11958
    "50 to 54" 11 17585548        . 1805457 128303 626255 18938        . 7023516  831065  62799 288810  9479  8977824 7190359  974392      . 337445  9459
    "55 to 59" 12 13469237        . 1306641  90531 433749 13428  6508729 5415680       .  43962 203331  6642  6960508 5691567  718379      . 230418  6786
    "60 to 64" 13 10805447        . 1063469  67189 342795 10142  5136627 4292670  468895  32324 160314  4908  5668820 4653172  594574      . 182481  5234
    "65 to 69" 14  9533545  8040225  881786  49463 274085  7698  4400362 3753923  374464  22837 119499  3747  5133183 4286302  507322  26626 154586  3951
    "70 to 74" 15  8857441  7648193  731386  36434 220066  5529  3902912 3407201  291976  16163  92669  2462  4954529 4240992  439410  20271 127397  3067
    "75 to 79" 16  7415813  6530019  550024  25608 155965  3614  3044456 2696297  206915  10701  67074  1537  4371357 3833722  343109  14907  88891  2077
    "80 to 84" 17  4945367  4408597  346465  14646  88183  2155  1834897 1643745  116030   5488  36339   907  3110470 2764852  230435   9158  51844  1248
    end
    label values agegrp agelbl
    label def agelbl 1 "Under 5", modify
    label def agelbl 2 "5 to 9", modify
    label def agelbl 3 "10 to 14", modify
    label def agelbl 4 "15 to 19", modify
    label def agelbl 5 "20 to 24", modify
    label def agelbl 6 "25 to 29", modify
    label def agelbl 7 "30 to 34", modify
    label def agelbl 8 "35 to 39", modify
    label def agelbl 9 "40 to 44", modify
    label def agelbl 10 "45 to 49", modify
    label def agelbl 11 "50 to 54", modify
    label def agelbl 12 "55 to 59", modify
    label def agelbl 13 "60 to 64", modify
    label def agelbl 14 "65 to 69", modify
    label def agelbl 15 "70 to 74", modify
    label def agelbl 16 "75 to 79", modify
    label def agelbl 17 "80 to 84", modify


    Code:
          misstable patterns total white black indian asian island maletotal malewhite
    
           Missing-value patterns
             (1 means complete)
    
                  |   Pattern
        Percent   |  1  2  3  4    5  6
      ------------+---------------------
           35%    |  1  1  1  1    1  1
                  |
           18     |  1  1  1  1    1  0
           12     |  1  1  1  0    0  1
           12     |  1  1  1  1    0  1
            6     |  0  0  0  1    1  0
            6     |  1  1  0  1    1  0
            6     |  1  1  0  1    1  1
            6     |  1  1  1  0    1  1
      ------------+---------------------
          100%    |
    
      Variables are  (1) asian  (2) island  (3) total  (4) maletotal  (5) white  (6) indian
     |
    Is there a way to assign these numbers to each individual row in a newvar? So, that an individual who has missing patern 3 will have newvar==3?
Working...
X