Announcement

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

  • Education Data

    For my Bachelor thesis I am replicating and extending research about the impact of mobile banking in Bangladesh.
    I am almost through the replication part but facing an error while trying to replicate education data of a household study.
    This is the following code provided.

    local section Education
    local index_variables sch_enrollment study_hour total_fees attendance aspirations_graduate

    foreach var in passed_exam `index_variables' {
    sum `var'_b if sch_enrollment != .
    gen z_`var' = (`var' - `r(mean)') / `r(sd)'
    gen z_`var'_b = (`var'_b - `r(mean)') / `r(sd)'
    }

    My problem consists in the gen_z part not working for the sch_enrollment variable (either value 1 for yes or . for no) thus blocking the creation of the other variables from index_variables.
    At first I thought there might be a problem with the syntax or the local macros but they seem to be fine.
    My second thought was a problem with my replication up to this point but this seems not to be case.

    I would really appreciate some help in this case for I am running out of ideas by now.

    Kind regards

    Jan-Niclas

  • #2
    in the most technical sense, maybe try replacing the . with 0 (zero) for no. seems like the SD of a variable that only takes value of 1 would be zero and stata probably doesn't want to divide by zero.

    Comment


    • #3
      Thanks a lot for your help.
      It works.

      Comment

      Working...
      X