Announcement

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

  • Problems with Putexcel command and looping

    Hello everyone,
    Sorry to bother you again.

    When I apply this code:
    Code:
    local row 2
    forvalues diploma_i = 0/3 {
    
      forvalues field_j = 1/4 {
    putexcel set Figures11_12_13.xlsx, sheet(Figure 13) modify
     svy,subpop(diploma_hes`diploma_i' if restricted_field`field_j' == 1) : prop k_uebverl
    matrix B = r(table)'
    local varlabel2 : var label diploma_hes`diploma_i'
    putexcel A`row' = matrix(B), rownames
    putexcel K`row' = "`varlabel2'"
    local row = `row' + rowsof(B)
             }
    }
    I get this error :
    Code:
     no observations in subpop() subpopulation subpop() = 1 indicates observation in subpopulation subpop() = 0 indicates observation not in subpopulation r(461);
    Could anyone help me please ?

    Thank you so much in advance.

  • #2

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte(diploma_hes0 diploma_hes1 diploma_hes2 diploma_hes3 restricted_field1 restricted_field2 restricted_field3 restricted_field4) float k_uebverl
    0 0 0 1 0 0 0 1 2.3428106
    0 0 0 1 0 0 1 0  2.588486
    0 0 0 1 0 1 0 0  2.980344
    0 0 0 1 1 0 0 0 1.9414893
    0 0 0 1 . . . .  2.491228
    0 0 1 0 0 0 0 1  3.970588
    0 0 1 0 0 0 1 0  4.231707
    0 0 1 0 0 1 0 0 2.4285715
    0 0 1 0 1 0 0 0  2.393035
    0 1 0 0 0 0 0 1  3.378007
    0 1 0 0 0 0 1 0 4.6729856
    0 1 0 0 0 1 0 0  2.617647
    0 1 0 0 1 0 0 0 1.9950658
    1 0 0 0 . . . .  1.819011
    . . . . . . . .  3.190728
    end

    Comment


    • #3
      Problem solved.

      Thanks.

      Comment

      Working...
      X