Announcement

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

  • How analyse the variable who is hv140_1 .... hv140_40 in one variable.

    i'm working on the registration of births in the DHS 2018 of Cameroon. i don't know how to manage the variable hv140 because it is in my database hv140_1, hv140_2, .... hv140_40.

    Please, can you tell me how to make it into a single variable before starting the analysis and finding the weighted birth registration rate.

    I'd also like to know how to calculate odds ratios.

  • #2
    Your question is pretty unclear. I'm going to speculate that what you mean is that there are 40 separate variables, named hv140_1 through hv140_40, and that in any observation, one of them contains a 1 and all the others are 0. I further speculate that what you want to do is convert this arrangement into a new variable, hv140 whose value is a number between 1 and 40 corresponding to which of the original variables contains a 1 in that observation. If that's right:

    Code:
    gen hv140 = .
    forvalues i = 1/40 {
        replace hv140 = `i' if hv140_`i' == 1
    }
    If, as seems likely, I have misunderstood your question, when posting back, show example data. And use the -dataex- command to do so. If you are running version 18, 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Now, -dataex- will not allow you to show all 40 of those variables. But if you just show, say, 10 of them from representative observations in your data, that should be sufficient to show what you actually are starting with. Then, for at least a few of the example observations, explain what the value of the resulting hv140 variable should be.

    Comment


    • #3
      Thanks for your feedback,

      In fact, the variables hv140_01 to hv140_40 are the variable member has a birth certificate, each having 4 unique values.
      But I want to group them all into a single hv140 variable with 4 unique values.

      here's a screenshot of the codebook for variable hv140_03.


      . codebook hv140_03

      ---------------------------------------------------------------------------------------------------------------------------------
      hv140_03 member has a birth certificate
      ---------------------------------------------------------------------------------------------------------------------------------

      type: numeric (byte)
      label: HV140_03

      range: [0,8] units: 1
      unique values: 4 missing .: 6,221/11,710

      tabulation: Freq. Numeric Label
      1,208 0 neither certificate or
      registered
      3,855 1 has certificate
      393 2 registered
      33 8 don't know
      6,221 .

      Comment


      • #4
        Clyde Schechter raised key points. The detail in #3 refutes one guess but I don’t think it is enough to answer his questions.

        dataex please!

        Comment

        Working...
        X