Announcement

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

  • Problem with svy: proportion, citype(exact)

    Hi everybody,

    I encounter a problem with svy: proportion var1 if var2==x, percent citype(exact) noomitted. The command stops with the following error code which does not occur if I leave out the citype(exact)
    _b_stat::fill_ciexact(): 3200 conformability error
    _b_stat::fill_ci(): - function returned error
    _b_stat::compute_p_ci(): - function returned error
    _b_stat::compute(): - function returned error
    _coef_table(): - function returned error
    <istmt>: - function returned error
    When copying the MWE from here into a do-file, Stata sometimes only has one observation and I don't know how to fix that. If the MWE is not helpful, I apologize, but I am at the end of my knowledge... I would be grateful for any insights on what is going wrong here.

    Here's the MWE
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double lfd float(cluster_pseudo schicht_pseudo) double gew_kal float(F30_kat F31_01_1_e2 F31_01_2_e2 F31_01_3_e2 F31_01_4_e2 F31_01_5_e2 F31_01_6_e2)
    10000007  6900 97081  .09556488566745759 2 . . . . . .
    10000213  6900 97081  .11022918490306952 2 . . . . . .
    10000463 16115 13914 .037251130236974704 2 . . . . . .
    10000659  6900 97081  .16630326791008504 2 . . . . . .
    10000678  1436 74503   8.484964268774284 1 . . . . . .
    10000701  6900 97081  .12132050057323163 3 1 0 0 0 1 1
    10000731  6900 97081  .08443256202710261 2 . . . . . .
    10000850  6900 97081  .08154279672229232 2 . . . . . .
    10001241 11243 13914  .27975702386490875 1 . . . . . .
    10001275  6900 97081  .11396183618045777 2 . . . . . .
    10001572  1333 32979  3.7998912765112265 2 0 0 0 0 1 1
    10001643  6900 97081   .1111010089463415 2 . . . . . .
    10001829  6900 97081  .13089310457279257 1 . . . . . .
    10001831 12186 32979   2.681610535930535 4 . . . . . .
    10001916 14397 13914  1.6213050188311768 1 . . . . . .
    10002061  6900 97081   .1854324057075744 4 . . . . . .
    10002186  6900 97081   .1948954685017602 3 . . . . . .
    10002244  6900 97081  .08587324888683155 1 . . . . . .
    10002437  2122 23562   .1399629701491556 3 0 0 0 0 0 1
    10002451  4064 92748  .09285347340227686 4 1 0 0 0 1 1
    10002643  6900 97081  .12572603550402142 2 0 0 0 0 1 1
    10002682  6900 97081  .04568053674064857 1 . . . . . .
    10002689 11512 23562   .7104329832427143 2 . . . . . .
    10003042 14335 75201   .2625379615518633 4 . . . . . .
    10003279  6900 97081  .07868399843740215 1 . . . . . .
    10003324  1939 13914   2.225675519470101 1 0 0 0 0 0 1
    10003380  1853 23562  .22373465688284605 2 . . . . . .
    10003514  6900 97081  .07904817977250808 1 . . . . . .
    10003563 11243 13914   .6190671493368273 1 . . . . . .
    10003571  6900 97081  .04568053674064857 3 1 0 0 1 1 1
    10003771 14956 32979  4.3596346257495435 4 . . . . . .
    10003819   856 32979   5.103886516399166 1 1 0 0 0 1 1
    10003928  6900 97081  .09928197270492484 2 . . . . . .
    10004493  6900 97081  .11965674997220364 2 . . . . . .
    10004522  6900 97081  .09203807133783753 2 . . . . . .
    10004894  7671 13914   .9634918047273169 2 . . . . . .
    10004948  6900 97081  .08587324888683155 1 . . . . . .
    10005026 10554 38618  1.5240852965407699 3 . . . . . .
    10005079 10101 13914  1.0056547230312713 2 . . . . . .
    10005124 14708 62991  .17785461747232834 2 . . . . . .
    10005175 14397 13914   .5792580291623299 4 . . . . . .
    10005243  6900 97081   .1048249279422961 2 . . . . . .
    10005325  5326 23562 .014292961730452408 3 . . . . . .
    10005346  6900 97081  .10172481971148917 2 . . . . . .
    10005398  4292 32979   3.646767552497527 3 1 0 0 1 1 1
    10005452  6900 97081  .06876217216260601 1 0 0 0 0 1 1
    10005792  6900 97081  .17183706903198812 3 . . . . . .
    10005846  6900 97081  .09203807133783753 4 . . . . . .
    10006058  2898 75533  3.5612099352387494 3 1 0 0 1 1 1
    10006251 10101 13914   .9338033002971105 3 1 1 0 0 1 1
    10006321  4543 62991  .14838028959409982 1 . . . . . .
    10006425  6900 97081 .006826139351562047 1 . . . . . .
    10006448  6900 97081  .22181657874751765 3 . . . . . .
    10006452  6900 97081   .0886507622709784 2 . . . . . .
    10006467 15687 86393  3.5912062445666004 2 . . . . . .
    10006491  6900 97081   .2165034136230178 4 . . . . . .
    10006512  6900 97081  .09895218286988787 3 . . . . . .
    10006541  6825 23562 .008381891387798095 3 . . . . . .
    10006543  1437 13914   .6745227945486072 1 . . . . . .
    10006640  6900 97081   .1257512246378008 3 . . . . . .
    10006750  6900 97081  .09907908315169794 3 1 0 0 0 1 1
    10006778  6900 97081  .09773567396966011 1 . . . . . .
    10007048 16372 13914  .04298985518805176 3 1 0 0 1 1 1
    10007115  2898 75533  2.9299379569864517 1 . . . . . .
    10007123  9846 62991 .006462929951425509 1 . . . . . .
    10007264  5467 23562  .29843084982472723 3 . . . . . .
    10007287  6900 97081    .109204339555111 3 . . . . . .
    10007288  6900 97081  .09577855659816156 2 . . . . . .
    10007476  6900 97081  .20291216097783954 3 . . . . . .
    10007482  1839 13914 .031732292355952665 1 . . . . . .
    10007879  6900 97081  .14702059397161985 3 . . . . . .
    10007984  8395 32979   4.217920857915759 1 . . . . . .
    10008053 15396 55827   3.072641102550636 4 . . . . . .
    10008309  6900 97081  .10523001262889048 3 . . . . . .
    10008444  6900 97081  .18834122473407977 1 . . . . . .
    10008468  1437 13914   .7333095957960153 3 . . . . . .
    10008532   717 13914   1.176272643177389 2 . . . . . .
    10008570 14397 13914   1.558942477277985 2 0 0 0 0 1 0
    10008576  6900 97081  .11316536670747898 4 . . . . . .
    10008636 12761 13914  .07756066329929959 3 . . . . . .
    10008653  6900 97081  .09488401494746401 3 . . . . . .
    10008667 10101 13914  1.2386481710335946 3 1 1 1 1 1 1
    10008701  6900 97081  .15850401941220477 3 1 0 0 0 1 1
    10008910  6900 97081  .10423751514774503 4 . . . . . .
    10008991  6900 97081   .1704727060107403 4 . . . . . .
    10009206  1437 13914   .6714967634601897 2 . . . . . .
    10009323  1437 13914  1.7322449108365499 2 . . . . . .
    10009390  6900 97081  .14523647168883927 4 . . . . . .
    10009421  6900 97081   .1343052300847493 4 . . . . . .
    10009463  6900 97081  .12466882899477678 2 . . . . . .
    10009477  6900 97081 .004050100585652371 3 . . . . . .
    10009532  6807 23562  .21196657798013996 2 . . . . . .
    10009757 12761 13914  .21875384069903425 1 . . . . . .
    10009775  7671 13914  .17857413435506722 1 . . . . . .
    10009899 14956 32979  3.5223227892103206 4 . . . . . .
    10009927  6900 97081  .13477741351714162 2 . . . . . .
    10009957 13028 92748   .2198208189449917 4 . . . . . .
    10009958 16115 13914     .81987214619309 1 . . . . . .
    10010033  6900 97081  .23374904338736716 1 . . . . . .
    10010131 12761 13914  .04232226687003231 1 . . . . . .
    end
    label values lfd misslab
    label values cluster_pseudo misslab
    label values gew_kal misslab
    label values schicht_pseudo misslab
    label values F30_kat F30_kat
    label def F30_kat 2 "Übergriff im Internet", modify
    label values F31_01_1_e2 F31_01_1_e
    label def F31_01_1_e 0 "0. nicht genannt", modify
    label def F31_01_1_e 1 "1. genannt", modify
    label def F31_01_1_e .b "unklar", modify
    label values F31_01_2_e2 F31_01_2_e
    label def F31_01_2_e 0 "0. nicht genannt", modify
    label def F31_01_2_e .b "unklar", modify
    label values F31_01_3_e2 F31_01_3_e
    label def F31_01_3_e 0 "0. nicht genannt", modify
    label def F31_01_3_e .b "unklar", modify
    label values F31_01_4_e2 F31_01_4_e
    label def F31_01_4_e 0 "0. nicht genannt", modify
    label def F31_01_4_e .b "unklar", modify
    label values F31_01_5_e2 F31_01_5_e
    label def F31_01_5_e 1 "1. genannt", modify
    label def F31_01_5_e .b "unklar", modify
    label values F31_01_6_e2 F31_01_6_e
    label def F31_01_6_e 0 "0. nicht genannt", modify
    label def F31_01_6_e 1 "1. genannt", modify
    label def F31_01_6_e .b "unklar", modify
    
    browse
    
    global F30_kat " `"1"' "
    global F31_01 " `"1"' "
    
    svyset cluster_pseudo [pweight=gew_kal], strata(schicht_pseudo) singleunit(certainty)
    
    
    mat F31_01_tat = J(4,6,.)
    local row = 1
    
    foreach value in $F30_kat {
    local col = 1
    foreach item in $F31_01 {
    svy: proportion F31_01_`item'_e2 if F30_kat==`value', percent citype(exact) noomitted
    matrix F31_01_tat[`row',`col']=( r(table)[rownumb(r(table), "b"),2] )
    tab F31_01_`item'_e2 if F30_kat==`value'
    if `r(r)'==1  {
    fre F31_01_`item'_e2 if F30_kat==`value'
    if strpos(`r(lab_valid)', "1") {
    matrix F31_01_tat[`row',`col'] = 100
    }
    if strpos(`r(lab_valid)', "0") {
    matrix F31_01_tat[`row',`col'] = 0
    }
    }
    local ++col
    }
    local ++row
    }
    matrix list F31_01_tat
Working...
X