Announcement

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

  • multivariable proportions

    Good morning,

    I have data that includes the following three variables:
    (1) survey respondents location of residence (i.e. rural and urban) (variable = centre) ;
    (2) whether respondent is part of a dog-owning or non-dog household (variable=dogown) and,
    (3) whether anyone in their household has been bitten by any dog including their own (variable=dogbite)

    I would like to calculate the proportion of households (dogown), within each centre, within which their has been dog bite incidents (dogbite) -

    *as a note, respondents were able to list the total number of people within their households who had been bitten (up to a maximum of 10). But I would simply like to show the percent dog bite incidents of at least one person in dog-owning and non-dog households, in rural and urban locations.

    How can this be completed in STATA please?

    Thank you
    Danielle

  • #2
    Hi Danielle,

    Please consider sharing a snippet of your data when posting questions, so others can see the structure of your data and even try codes.

    The last line of the code below should work (other lines were just an attempt to simulate your database).

    Code:
    clear
    input long(centre dogown) float(dogbite random)
    1 1 0  7
    1 1 1 10
    1 2 0  4
    1 2 1  2
    2 1 0  6
    2 1 1 10
    2 2 0  7
    2 2 1 10
    end
    label values centre centre_l
    label def centre_l 1 "rural", modify
    label def centre_l 2 "urban", modify
    label values dogown dogown_l
    label def dogown_l 1 "dog-owning", modify
    label def dogown_l 2 "non-dog", modify
    expand random
    
    by centre, sort : tab dogown dogbite, row

    Comment


    • #3
      Thank you so much and sorry about that!

      Would you mind reminding me about how I can share my data for the next time please?

      Sorry again
      Danielle

      Comment


      • #4
        Hi Danielle,

        Statalist help has several tips. Please read 12.2 and 12.3.

        Best;
        Last edited by Igor Paploski; 12 Jun 2018, 12:27. Reason: Adding link.

        Comment

        Working...
        X