Announcement

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

  • How to generate summary household characteristics from profiles of individual members

    Hi everyone,

    I am new to stata and just trying to find my way around. I am not sure if this question has been asked and answered before, but after searching all over, I couldn't find a solution.
    I have a dataset that was collected using ODK in which the parent question asks about the total number of people in the household. The next set of questions then ask about the characteristics of each individual in the household. These include Status in the household (e.g Head, Spouse, Son/Daughter, etc); Age; Sex; PWD status; Level of Education; Occupation; and Marital status. Based on these individual profiles, I would like to generate summary statistics indicating the percentage of households that meet certain characteristics as follow:
    1. Households with a child under five years
    2. Households with an elderly person (65 years and above)
    3. Households with a PWD
    4. Sex of the Household head
    5. Households where the head has no education
    6. Households where any member has attained post-secondary education

    Since the dataset was generated by ODK, it contains PARENT_KEY (which would correspond with a unique HH ID No), KEY (which corresponds with a unique ID for each individual in a particular household). Friends, I would appreciate it if anyone can help me solve these issues (if possible with a Do file). From reading various online guides, I tried different commands, but none could give me what I am looking for. I am hoping to get assistance here. Many thanks

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int Q201b byte(Q201b_GRPD Q201c) str13 Q201ca byte(Q201d Q201e Q201f Q201g Q201h) str18 Q201ha byte Q201i str41 PARENT_KEY str50 KEY str46 SETOFQ201
     30 6 1 "" 1 1 2 2 13 "" 3 "uuid:c26533ab-19d4-449c-86d8-07c3f898bb06" "uuid:c26533ab-19d4-449c-86d8-07c3f898bb06/Q201[1]"  "uuid:c26533ab-19d4-449c-86d8-07c3f898bb06/Q201"
     45 6 1 "" 2 1 2 2 13 "" 3 "uuid:39a8c0dd-674b-4981-b328-9d8613dedd7d" "uuid:39a8c0dd-674b-4981-b328-9d8613dedd7d/Q201[2]"  "uuid:39a8c0dd-674b-4981-b328-9d8613dedd7d/Q201"
     32 6 1 "" 2 1 2 2 13 "" 3 "uuid:f91e9f2a-5f25-46e6-908b-58a984566c7d" "uuid:f91e9f2a-5f25-46e6-908b-58a984566c7d/Q201[2]"  "uuid:f91e9f2a-5f25-46e6-908b-58a984566c7d/Q201"
     60 6 4 "" 2 2 3 2 12 "" 3 "uuid:0d02e8d6-bddb-4562-9a71-cbaa9cbd5a85" "uuid:0d02e8d6-bddb-4562-9a71-cbaa9cbd5a85/Q201[2]"  "uuid:0d02e8d6-bddb-4562-9a71-cbaa9cbd5a85/Q201"
     13 3 4 "" 2 1 1 2 12 "" 1 "uuid:cccb0077-4a3b-40f7-81e2-930db6757f9b" "uuid:cccb0077-4a3b-40f7-81e2-930db6757f9b/Q201[5]"  "uuid:cccb0077-4a3b-40f7-81e2-930db6757f9b/Q201"
     16 3 4 "" 2 2 1 1 12 "" 3 "uuid:b095bff3-2864-4fc2-abc6-0d8ef7f19c4c" "uuid:b095bff3-2864-4fc2-abc6-0d8ef7f19c4c/Q201[2]"  "uuid:b095bff3-2864-4fc2-abc6-0d8ef7f19c4c/Q201"
     58 6 2 "" 1 2 2 2 12 "" 3 "uuid:2e4708bb-4bbb-4828-87c1-f6bfe2882bf0" "uuid:2e4708bb-4bbb-4828-87c1-f6bfe2882bf0/Q201[1]"  "uuid:2e4708bb-4bbb-4828-87c1-f6bfe2882bf0/Q201"
     50 6 3 "" 2 2 1 1 12 "" 1 "uuid:39134fb8-d930-418a-b008-da34945a6840" "uuid:39134fb8-d930-418a-b008-da34945a6840/Q201[7]"  "uuid:39134fb8-d930-418a-b008-da34945a6840/Q201"
     53 6 4 "" 2 2 2 1 12 "" 4 "uuid:3cce54ec-2482-492f-9aa6-364a77a0b06e" "uuid:3cce54ec-2482-492f-9aa6-364a77a0b06e/Q201[3]"  "uuid:3cce54ec-2482-492f-9aa6-364a77a0b06e/Q201"
     37 6 3 "" 2 2 4 2 12 "" 4 "uuid:26a9ae0b-6578-4d0b-bde1-736079dec4ac" "uuid:26a9ae0b-6578-4d0b-bde1-736079dec4ac/Q201[5]"  "uuid:26a9ae0b-6578-4d0b-bde1-736079dec4ac/Q201"
     20 4 3 "" 2 1 1 1 12 "" 1 "uuid:7f632532-5371-49b5-bb1e-80f0aa9e15a3" "uuid:7f632532-5371-49b5-bb1e-80f0aa9e15a3/Q201[4]"  "uuid:7f632532-5371-49b5-bb1e-80f0aa9e15a3/Q201"
     14 3 4 "" 2 2 1 2 12 "" 1 "uuid:618a8105-f7a2-402c-8114-9b893157a1ca" "uuid:618a8105-f7a2-402c-8114-9b893157a1ca/Q201[2]"  "uuid:618a8105-f7a2-402c-8114-9b893157a1ca/Q201"
     30 6 3 "" 2 2 1 1 12 "" 4 "uuid:ff4afa8f-a67e-4a50-810e-882379a611a6" "uuid:ff4afa8f-a67e-4a50-810e-882379a611a6/Q201[3]"  "uuid:ff4afa8f-a67e-4a50-810e-882379a611a6/Q201"
     14 3 3 "" 2 1 1 1 12 "" 3 "uuid:edf4c21c-bc95-4e14-ac3b-17131b073c85" "uuid:edf4c21c-bc95-4e14-ac3b-17131b073c85/Q201[6]"  "uuid:edf4c21c-bc95-4e14-ac3b-17131b073c85/Q201"
     17 3 3 "" 2 1 1 1 12 "" 1 "uuid:0f036ad5-4167-40d4-992a-a74fe1bb44e4" "uuid:0f036ad5-4167-40d4-992a-a74fe1bb44e4/Q201[3]"  "uuid:0f036ad5-4167-40d4-992a-a74fe1bb44e4/Q201"
     25 5 3 "" 2 2 1 2 12 "" 4 "uuid:83c1c8a3-3216-4869-9754-77b60fdc90d1" "uuid:83c1c8a3-3216-4869-9754-77b60fdc90d1/Q201[2]"  "uuid:83c1c8a3-3216-4869-9754-77b60fdc90d1/Q201"
     21 4 3 "" 1 2 1 2 12 "" 4 "uuid:8b1567da-509b-4f92-a7f8-c1ea3c849317" "uuid:8b1567da-509b-4f92-a7f8-c1ea3c849317/Q201[1]"  "uuid:8b1567da-509b-4f92-a7f8-c1ea3c849317/Q201"
     14 3 4 "" 2 2 1 1 12 "" 1 "uuid:2f90a222-375c-43c3-9208-09919de0c540" "uuid:2f90a222-375c-43c3-9208-09919de0c540/Q201[7]"  "uuid:2f90a222-375c-43c3-9208-09919de0c540/Q201"
     11 3 4 "" 2 1 1 2 12 "" 1 "uuid:c42ae445-7981-42f3-943a-95a60bee9c35" "uuid:c42ae445-7981-42f3-943a-95a60bee9c35/Q201[3]"  "uuid:c42ae445-7981-42f3-943a-95a60bee9c35/Q201"
     29 5 4 "" 2 1 1 1 12 "" 2 "uuid:4269bfbd-3e5c-4781-ae49-fecf1f028f10" "uuid:4269bfbd-3e5c-4781-ae49-fecf1f028f10/Q201[4]"  "uuid:4269bfbd-3e5c-4781-ae49-fecf1f028f10/Q201"
     20 4 4 "" 2 2 1 2 12 "" 4 "uuid:8515f122-7cb1-44d0-9104-07fb6f397520" "uuid:8515f122-7cb1-44d0-9104-07fb6f397520/Q201[3]"  "uuid:8515f122-7cb1-44d0-9104-07fb6f397520/Q201"
     24 4 4 "" 2 2 1 2 12 "" 4 "uuid:99d55fcf-fa0b-4598-b99d-c18fedcae8e7" "uuid:99d55fcf-fa0b-4598-b99d-c18fedcae8e7/Q201[3]"  "uuid:99d55fcf-fa0b-4598-b99d-c18fedcae8e7/Q201"
     24 4 3 "" 2 2 2 2 12 "" 6 "uuid:edf4c21c-bc95-4e14-ac3b-17131b073c85" "uuid:edf4c21c-bc95-4e14-ac3b-17131b073c85/Q201[3]"  "uuid:edf4c21c-bc95-4e14-ac3b-17131b073c85/Q201"
     23 4 1 "" 1 1 1 2 12 "" 5 "uuid:755458f9-2480-4cf0-8241-5230cdd7eebb" "uuid:755458f9-2480-4cf0-8241-5230cdd7eebb/Q201[1]"  "uuid:755458f9-2480-4cf0-8241-5230cdd7eebb/Q201"
     20 4 4 "" 2 2 1 2 12 "" 3 "uuid:86d18840-3c6d-4dd8-b9ef-28f8bbce38da" "uuid:86d18840-3c6d-4dd8-b9ef-28f8bbce38da/Q201[2]"  "uuid:86d18840-3c6d-4dd8-b9ef-28f8bbce38da/Q201"
     86 6 4 "" 2 2 3 2 10 "" 3 "uuid:0f2060f1-1783-4dd3-93b6-9274e5c050be" "uuid:0f2060f1-1783-4dd3-93b6-9274e5c050be/Q201[2]"  "uuid:0f2060f1-1783-4dd3-93b6-9274e5c050be/Q201"
     70 6 4 "" 2 2 4 2 10 "" 3 "uuid:0855b6c5-7199-4d20-857c-02d5d56d13a5" "uuid:0855b6c5-7199-4d20-857c-02d5d56d13a5/Q201[5]"  "uuid:0855b6c5-7199-4d20-857c-02d5d56d13a5/Q201"
     83 6 1 "" 1 2 4 2 10 "" 3 "uuid:9e4cefa2-6241-4314-84e4-fe771a152895" "uuid:9e4cefa2-6241-4314-84e4-fe771a152895/Q201[1]"  "uuid:9e4cefa2-6241-4314-84e4-fe771a152895/Q201"
     80 6 4 "" 2 2 4 1 10 "" 3 "uuid:d7bc369c-2248-46ca-bfbf-44a5bd5b8936" "uuid:d7bc369c-2248-46ca-bfbf-44a5bd5b8936/Q201[3]"  "uuid:d7bc369c-2248-46ca-bfbf-44a5bd5b8936/Q201"
     75 6 1 "" 1 2 4 2 10 "" 3 "uuid:f6391f64-bd84-4752-978f-b5017003f1c7" "uuid:f6391f64-bd84-4752-978f-b5017003f1c7/Q201[1]"  "uuid:f6391f64-bd84-4752-978f-b5017003f1c7/Q201"
      3 1 4 "" 2 1 1 2 10 "" 1 "uuid:0a3a5798-ecba-4e09-b0c2-7e9e25e177c5" "uuid:0a3a5798-ecba-4e09-b0c2-7e9e25e177c5/Q201[7]"  "uuid:0a3a5798-ecba-4e09-b0c2-7e9e25e177c5/Q201"
     70 6 1 "" 1 1 3 2 10 "" 1 "uuid:530311a7-bdd0-4b6e-88c9-3e634afe9f5f" "uuid:530311a7-bdd0-4b6e-88c9-3e634afe9f5f/Q201[1]"  "uuid:530311a7-bdd0-4b6e-88c9-3e634afe9f5f/Q201"
      4 1 3 "" 2 2 1 2 10 "" 1 "uuid:1c9a79e8-761e-4e41-9f9f-b011e48cdee2" "uuid:1c9a79e8-761e-4e41-9f9f-b011e48cdee2/Q201[3]"  "uuid:1c9a79e8-761e-4e41-9f9f-b011e48cdee2/Q201"
     70 6 1 "" 2 1 2 1 10 "" 3 "uuid:c42ae445-7981-42f3-943a-95a60bee9c35" "uuid:c42ae445-7981-42f3-943a-95a60bee9c35/Q201[2]"  "uuid:c42ae445-7981-42f3-943a-95a60bee9c35/Q201"
     70 6 1 "" 1 2 4 2 10 "" 3 "uuid:8eb043b5-f66f-4c40-b76e-74d6becde939" "uuid:8eb043b5-f66f-4c40-b76e-74d6becde939/Q201[1]"  "uuid:8eb043b5-f66f-4c40-b76e-74d6becde939/Q201"
     92 6 4 "" 2 1 4 2 10 "" 1 "uuid:b41adcce-bed6-4b7d-a71c-633dc2c3decc" "uuid:b41adcce-bed6-4b7d-a71c-633dc2c3decc/Q201[2]"  "uuid:b41adcce-bed6-4b7d-a71c-633dc2c3decc/Q201"
     65 6 1 "" 2 2 4 2 10 "" 6 "uuid:4269bfbd-3e5c-4781-ae49-fecf1f028f10" "uuid:4269bfbd-3e5c-4781-ae49-fecf1f028f10/Q201[1]"  "uuid:4269bfbd-3e5c-4781-ae49-fecf1f028f10/Q201"
     75 6 4 "" 2 1 4 2 10 "" 3 "uuid:35769152-f181-4e62-a9a1-f1743522fcb1" "uuid:35769152-f181-4e62-a9a1-f1743522fcb1/Q201[5]"  "uuid:35769152-f181-4e62-a9a1-f1743522fcb1/Q201"
     72 6 1 "" 2 1 2 2 10 "" 6 "uuid:67c4fedf-e61c-46c3-885a-a3bd1a49f217" "uuid:67c4fedf-e61c-46c3-885a-a3bd1a49f217/Q201[1]"  "uuid:67c4fedf-e61c-46c3-885a-a3bd1a49f217/Q201"
     67 6 2 "" 1 2 2 2 10 "" 6 "uuid:67c4fedf-e61c-46c3-885a-a3bd1a49f217" "uuid:67c4fedf-e61c-46c3-885a-a3bd1a49f217/Q201[2]"  "uuid:67c4fedf-e61c-46c3-885a-a3bd1a49f217/Q201"
     79 6 1 "" 2 1 2 2 10 "" 6 "uuid:3cce54ec-2482-492f-9aa6-364a77a0b06e" "uuid:3cce54ec-2482-492f-9aa6-364a77a0b06e/Q201[1]"  "uuid:3cce54ec-2482-492f-9aa6-364a77a0b06e/Q201"
     69 6 2 "" 2 2 2 2 10 "" 6 "uuid:3cce54ec-2482-492f-9aa6-364a77a0b06e" "uuid:3cce54ec-2482-492f-9aa6-364a77a0b06e/Q201[2]"  "uuid:3cce54ec-2482-492f-9aa6-364a77a0b06e/Q201"
     76 6 1 "" 2 1 3 2 10 "" 1 "uuid:3e0e8a9b-a255-42c5-aa38-f32d83b87863" "uuid:3e0e8a9b-a255-42c5-aa38-f32d83b87863/Q201[1]"  "uuid:3e0e8a9b-a255-42c5-aa38-f32d83b87863/Q201"
     90 6 1 "" 1 2 4 2 10 "" 1 "uuid:b10f3d32-1efc-4b4b-a231-ccf31bf8bd17" "uuid:b10f3d32-1efc-4b4b-a231-ccf31bf8bd17/Q201[1]"  "uuid:b10f3d32-1efc-4b4b-a231-ccf31bf8bd17/Q201"
     86 6 1 "" 1 1 1 2 10 "" 3 "uuid:acc27d6a-180e-4241-9a6a-bd0fbde52d1b" "uuid:acc27d6a-180e-4241-9a6a-bd0fbde52d1b/Q201[1]"  "uuid:acc27d6a-180e-4241-9a6a-bd0fbde52d1b/Q201"
      1 1 3 "" 2 1 1 2 10 "" 1 "uuid:5c8a0da7-6c4c-491f-8b93-1e8c1ae70cda" "uuid:5c8a0da7-6c4c-491f-8b93-1e8c1ae70cda/Q201[3]"  "uuid:5c8a0da7-6c4c-491f-8b93-1e8c1ae70cda/Q201"
      1 1 4 "" 2 2 1 2 10 "" 1 "uuid:4cddbb0a-66bd-48d8-838d-3e99d665554c" "uuid:4cddbb0a-66bd-48d8-838d-3e99d665554c/Q201[6]"  "uuid:4cddbb0a-66bd-48d8-838d-3e99d665554c/Q201"
      4 1 3 "" 2 2 1 2 10 "" 1 "uuid:9e9ac14a-6aa7-4353-b46e-5b86daa425aa" "uuid:9e9ac14a-6aa7-4353-b46e-5b86daa425aa/Q201[8]"  "uuid:9e9ac14a-6aa7-4353-b46e-5b86daa425aa/Q201"
      2 1 3 "" 2 1 1 2 10 "" 1 "uuid:1104bf1a-89d1-46f5-8b0e-81359c422b1e" "uuid:1104bf1a-89d1-46f5-8b0e-81359c422b1e/Q201[4]"  "uuid:1104bf1a-89d1-46f5-8b0e-81359c422b1e/Q201"
      1 1 3 "" 2 2 1 2 10 "" 1 "uuid:f659d3ad-88d2-46ee-ade6-7197344722d8" "uuid:f659d3ad-88d2-46ee-ade6-7197344722d8/Q201[3]"  "uuid:f659d3ad-88d2-46ee-ade6-7197344722d8/Q201"
      2 1 7 "" 2 1 1 2 10 "" 9 "uuid:aadbac46-2280-4253-8197-217eddfa2dba" "uuid:aadbac46-2280-4253-8197-217eddfa2dba/Q201[4]"  "uuid:aadbac46-2280-4253-8197-217eddfa2dba/Q201"
      3 1 7 "" 2 2 1 2 10 "" 9 "uuid:3ae6d1dc-0ee1-4c50-a8c4-04c7c742df07" "uuid:3ae6d1dc-0ee1-4c50-a8c4-04c7c742df07/Q201[5]"  "uuid:3ae6d1dc-0ee1-4c50-a8c4-04c7c742df07/Q201"
      3 1 7 "" 2 2 1 2 10 "" 9 "uuid:f228721c-5952-485a-8743-0eae6adeb8b0" "uuid:f228721c-5952-485a-8743-0eae6adeb8b0/Q201[14]" "uuid:f228721c-5952-485a-8743-0eae6adeb8b0/Q201"
      2 1 7 "" 2 1 1 2 10 "" 9 "uuid:f228721c-5952-485a-8743-0eae6adeb8b0" "uuid:f228721c-5952-485a-8743-0eae6adeb8b0/Q201[15]" "uuid:f228721c-5952-485a-8743-0eae6adeb8b0/Q201"
      4 1 7 "" 2 2 1 2 10 "" 1 "uuid:031611ef-60da-4cb0-a745-e24d26340a5f" "uuid:031611ef-60da-4cb0-a745-e24d26340a5f/Q201[5]"  "uuid:031611ef-60da-4cb0-a745-e24d26340a5f/Q201"
      3 1 7 "" 2 2 1 2 10 "" 1 "uuid:dd1f3503-e846-4061-a70f-0a3431b3fbab" "uuid:dd1f3503-e846-4061-a70f-0a3431b3fbab/Q201[4]"  "uuid:dd1f3503-e846-4061-a70f-0a3431b3fbab/Q201"
      3 1 7 "" 2 1 1 2 10 "" 9 "uuid:af09e518-7200-44c5-ac1f-aff59b1a36cc" "uuid:af09e518-7200-44c5-ac1f-aff59b1a36cc/Q201[6]"  "uuid:af09e518-7200-44c5-ac1f-aff59b1a36cc/Q201"
      2 1 7 "" 2 1 1 2 10 "" 1 "uuid:7f2153d9-db64-4e15-8d41-f6889984d473" "uuid:7f2153d9-db64-4e15-8d41-f6889984d473/Q201[3]"  "uuid:7f2153d9-db64-4e15-8d41-f6889984d473/Q201"
      2 1 7 "" 2 1 1 2 10 "" 9 "uuid:911309cb-a269-4c55-883b-5274423fac97" "uuid:911309cb-a269-4c55-883b-5274423fac97/Q201[7]"  "uuid:911309cb-a269-4c55-883b-5274423fac97/Q201"
      2 1 7 "" 2 1 1 2 10 "" 9 "uuid:f90ca7e4-94c9-4ca1-acc9-6f12bf42be36" "uuid:f90ca7e4-94c9-4ca1-acc9-6f12bf42be36/Q201[4]"  "uuid:f90ca7e4-94c9-4ca1-acc9-6f12bf42be36/Q201"
     75 6 4 "" 2 1 4 2 10 "" 3 "uuid:34f987aa-7731-4878-a42c-dc15721c4a78" "uuid:34f987aa-7731-4878-a42c-dc15721c4a78/Q201[3]"  "uuid:34f987aa-7731-4878-a42c-dc15721c4a78/Q201"
     80 6 4 "" 2 2 4 2 10 "" 1 "uuid:78d74c45-81ec-46cf-942d-eb3f8ac0f764" "uuid:78d74c45-81ec-46cf-942d-eb3f8ac0f764/Q201[2]"  "uuid:78d74c45-81ec-46cf-942d-eb3f8ac0f764/Q201"
      1 1 3 "" 2 2 1 2 10 "" 9 "uuid:aa6abe14-444c-4d88-a3d4-ff45ac9d4a2f" "uuid:aa6abe14-444c-4d88-a3d4-ff45ac9d4a2f/Q201[5]"  "uuid:aa6abe14-444c-4d88-a3d4-ff45ac9d4a2f/Q201"
      2 1 3 "" 2 2 1 2 10 "" 9 "uuid:24d6bd78-989c-41d1-9fdb-e80e9e443ac5" "uuid:24d6bd78-989c-41d1-9fdb-e80e9e443ac5/Q201[3]"  "uuid:24d6bd78-989c-41d1-9fdb-e80e9e443ac5/Q201"
      5 1 4 "" 2 1 1 2 10 "" 9 "uuid:24d6bd78-989c-41d1-9fdb-e80e9e443ac5" "uuid:24d6bd78-989c-41d1-9fdb-e80e9e443ac5/Q201[5]"  "uuid:24d6bd78-989c-41d1-9fdb-e80e9e443ac5/Q201"
      1 1 3 "" 2 1 2 2 10 "" 9 "uuid:24d9acf0-d306-4de3-bf41-18d283267569" "uuid:24d9acf0-d306-4de3-bf41-18d283267569/Q201[4]"  "uuid:24d9acf0-d306-4de3-bf41-18d283267569/Q201"
      1 1 4 "" 2 2 1 2 10 "" 1 "uuid:ab7e6666-148b-4ae6-a9ef-6c152a8be868" "uuid:ab7e6666-148b-4ae6-a9ef-6c152a8be868/Q201[4]"  "uuid:ab7e6666-148b-4ae6-a9ef-6c152a8be868/Q201"
      2 1 3 "" 2 1 1 2 10 "" 9 "uuid:5c594532-62c6-4219-81a8-7f22c5a74faa" "uuid:5c594532-62c6-4219-81a8-7f22c5a74faa/Q201[6]"  "uuid:5c594532-62c6-4219-81a8-7f22c5a74faa/Q201"
      1 1 3 "" 2 2 1 2 10 "" 9 "uuid:5c594532-62c6-4219-81a8-7f22c5a74faa" "uuid:5c594532-62c6-4219-81a8-7f22c5a74faa/Q201[7]"  "uuid:5c594532-62c6-4219-81a8-7f22c5a74faa/Q201"
      3 1 3 "" 2 1 1 2 10 "" 1 "uuid:25306c1e-0ceb-4666-8a7e-2ef2525f3dfd" "uuid:25306c1e-0ceb-4666-8a7e-2ef2525f3dfd/Q201[3]"  "uuid:25306c1e-0ceb-4666-8a7e-2ef2525f3dfd/Q201"
      3 1 3 "" 2 1 1 2 10 "" 9 "uuid:5c71abae-baee-4f27-8f32-fe62a96a7a91" "uuid:5c71abae-baee-4f27-8f32-fe62a96a7a91/Q201[3]"  "uuid:5c71abae-baee-4f27-8f32-fe62a96a7a91/Q201"
      3 1 3 "" 2 2 1 2 10 "" 9 "uuid:ac3f0997-5721-40bd-ae3e-f02b315c058f" "uuid:ac3f0997-5721-40bd-ae3e-f02b315c058f/Q201[3]"  "uuid:ac3f0997-5721-40bd-ae3e-f02b315c058f/Q201"
      2 1 3 "" 2 1 1 2 10 "" 1 "uuid:5cf1320d-ff1c-4738-8bb4-fad0d001b066" "uuid:5cf1320d-ff1c-4738-8bb4-fad0d001b066/Q201[4]"  "uuid:5cf1320d-ff1c-4738-8bb4-fad0d001b066/Q201"
      1 1 3 "" 2 1 1 2 10 "" 1 "uuid:ac4aed8c-5cd4-4a5b-bd0c-fe1c20bcdff7" "uuid:ac4aed8c-5cd4-4a5b-bd0c-fe1c20bcdff7/Q201[4]"  "uuid:ac4aed8c-5cd4-4a5b-bd0c-fe1c20bcdff7/Q201"
      3 1 3 "" 2 2 1 2 10 "" 9 "uuid:2675c9ba-5b6f-46bb-a598-8b91ee1a5ede" "uuid:2675c9ba-5b6f-46bb-a598-8b91ee1a5ede/Q201[4]"  "uuid:2675c9ba-5b6f-46bb-a598-8b91ee1a5ede/Q201"
      1 1 3 "" 2 1 1 2 10 "" 9 "uuid:2675c9ba-5b6f-46bb-a598-8b91ee1a5ede" "uuid:2675c9ba-5b6f-46bb-a598-8b91ee1a5ede/Q201[5]"  "uuid:2675c9ba-5b6f-46bb-a598-8b91ee1a5ede/Q201"
      3 1 3 "" 2 2 1 2 10 "" 9 "uuid:2678a14a-6518-45d2-b83f-fd26fb3fdd56" "uuid:2678a14a-6518-45d2-b83f-fd26fb3fdd56/Q201[3]"  "uuid:2678a14a-6518-45d2-b83f-fd26fb3fdd56/Q201"
      1 1 3 "" 2 1 1 2 10 "" 9 "uuid:ad45da3d-7d6b-4a77-9726-828cd9eb6ab7" "uuid:ad45da3d-7d6b-4a77-9726-828cd9eb6ab7/Q201[7]"  "uuid:ad45da3d-7d6b-4a77-9726-828cd9eb6ab7/Q201"
      3 1 3 "" 2 2 1 2 10 "" 9 "uuid:5f384de5-8d4f-4e43-aeb2-1391a446ff72" "uuid:5f384de5-8d4f-4e43-aeb2-1391a446ff72/Q201[6]"  "uuid:5f384de5-8d4f-4e43-aeb2-1391a446ff72/Q201"
      2 1 4 "" 2 1 1 2 10 "" 9 "uuid:26a9ae0b-6578-4d0b-bde1-736079dec4ac" "uuid:26a9ae0b-6578-4d0b-bde1-736079dec4ac/Q201[6]"  "uuid:26a9ae0b-6578-4d0b-bde1-736079dec4ac/Q201"
      3 1 4 "" 2 2 1 2 10 "" 9 "uuid:26a9ae0b-6578-4d0b-bde1-736079dec4ac" "uuid:26a9ae0b-6578-4d0b-bde1-736079dec4ac/Q201[7]"  "uuid:26a9ae0b-6578-4d0b-bde1-736079dec4ac/Q201"
      2 1 3 "" 2 2 1 2 10 "" 9 "uuid:26bbb3e2-2c65-4244-a06f-5329f6dee70a" "uuid:26bbb3e2-2c65-4244-a06f-5329f6dee70a/Q201[5]"  "uuid:26bbb3e2-2c65-4244-a06f-5329f6dee70a/Q201"
      2 1 3 "" 2 1 1 2 10 "" 1 "uuid:af036d56-7c2f-4e48-9685-dd57dfd8fb4a" "uuid:af036d56-7c2f-4e48-9685-dd57dfd8fb4a/Q201[3]"  "uuid:af036d56-7c2f-4e48-9685-dd57dfd8fb4a/Q201"
      1 1 3 "" 2 1 1 2 10 "" 1 "uuid:af2b412f-1eaf-4431-af65-eaac411d5b04" "uuid:af2b412f-1eaf-4431-af65-eaac411d5b04/Q201[3]"  "uuid:af2b412f-1eaf-4431-af65-eaac411d5b04/Q201"
      2 1 3 "" 2 1 1 2 10 "" 9 "uuid:af6b51e0-f7bc-474c-91c9-a9eab9d5db46" "uuid:af6b51e0-f7bc-474c-91c9-a9eab9d5db46/Q201[2]"  "uuid:af6b51e0-f7bc-474c-91c9-a9eab9d5db46/Q201"
      0 1 5 "" 2 1 1 2 10 "" 9 "uuid:605ddd57-610c-48db-b6f1-13e8e077b21e" "uuid:605ddd57-610c-48db-b6f1-13e8e077b21e/Q201[9]"  "uuid:605ddd57-610c-48db-b6f1-13e8e077b21e/Q201"
      3 1 4 "" 1 1 1 2 10 "" 1 "uuid:b095bff3-2864-4fc2-abc6-0d8ef7f19c4c" "uuid:b095bff3-2864-4fc2-abc6-0d8ef7f19c4c/Q201[4]"  "uuid:b095bff3-2864-4fc2-abc6-0d8ef7f19c4c/Q201"
      2 1 3 "" 2 2 2 2 10 "" 9 "uuid:619e486b-842a-441f-9397-2c1b27906f93" "uuid:619e486b-842a-441f-9397-2c1b27906f93/Q201[3]"  "uuid:619e486b-842a-441f-9397-2c1b27906f93/Q201"
      3 1 3 "" 2 2 1 2 10 "" 1 "uuid:b1533583-e739-4908-9826-4cc11d2fa788" "uuid:b1533583-e739-4908-9826-4cc11d2fa788/Q201[6]"  "uuid:b1533583-e739-4908-9826-4cc11d2fa788/Q201"
      3 1 3 "" 2 2 1 2 10 "" 1 "uuid:b1533583-e739-4908-9826-4cc11d2fa788" "uuid:b1533583-e739-4908-9826-4cc11d2fa788/Q201[7]"  "uuid:b1533583-e739-4908-9826-4cc11d2fa788/Q201"
      2 1 3 "" 2 1 1 2 10 "" 9 "uuid:626f5089-060a-4003-b0d2-a250a59b81da" "uuid:626f5089-060a-4003-b0d2-a250a59b81da/Q201[3]"  "uuid:626f5089-060a-4003-b0d2-a250a59b81da/Q201"
      5 1 3 "" 2 2 1 2 10 "" 9 "uuid:628a0b5c-173a-4ba7-99dc-9b3f584e1b9a" "uuid:628a0b5c-173a-4ba7-99dc-9b3f584e1b9a/Q201[4]"  "uuid:628a0b5c-173a-4ba7-99dc-9b3f584e1b9a/Q201"
      3 1 3 "" 2 1 1 2 10 "" 9 "uuid:628a0b5c-173a-4ba7-99dc-9b3f584e1b9a" "uuid:628a0b5c-173a-4ba7-99dc-9b3f584e1b9a/Q201[5]"  "uuid:628a0b5c-173a-4ba7-99dc-9b3f584e1b9a/Q201"
      3 1 3 "" 2 2 1 2 10 "" 1 "uuid:29f5870f-692c-40cd-a908-bee55d44cada" "uuid:29f5870f-692c-40cd-a908-bee55d44cada/Q201[4]"  "uuid:29f5870f-692c-40cd-a908-bee55d44cada/Q201"
      2 1 4 "" 2 2 1 2 10 "" 9 "uuid:63275a9a-9eac-4ebd-b311-6c8b8f9f8cf5" "uuid:63275a9a-9eac-4ebd-b311-6c8b8f9f8cf5/Q201[7]"  "uuid:63275a9a-9eac-4ebd-b311-6c8b8f9f8cf5/Q201"
      2 1 3 "" 2 1 1 2 10 "" 9 "uuid:2c96a49d-063c-4765-88d2-1ede3cd33c6f" "uuid:2c96a49d-063c-4765-88d2-1ede3cd33c6f/Q201[6]"  "uuid:2c96a49d-063c-4765-88d2-1ede3cd33c6f/Q201"
      1 1 3 "" 2 1 1 2 10 "" 9 "uuid:2c96a49d-063c-4765-88d2-1ede3cd33c6f" "uuid:2c96a49d-063c-4765-88d2-1ede3cd33c6f/Q201[7]"  "uuid:2c96a49d-063c-4765-88d2-1ede3cd33c6f/Q201"
     80 6 4 "" 2 2 3 2 10 "" 1 "uuid:b49a15a6-63db-4708-9e57-073739472a01" "uuid:b49a15a6-63db-4708-9e57-073739472a01/Q201[2]"  "uuid:b49a15a6-63db-4708-9e57-073739472a01/Q201"
    100 6 4 "" 2 2 4 2 10 "" 1 "uuid:b49a15a6-63db-4708-9e57-073739472a01" "uuid:b49a15a6-63db-4708-9e57-073739472a01/Q201[3]"  "uuid:b49a15a6-63db-4708-9e57-073739472a01/Q201"
      0 1 3 "" 2 1 1 2 10 "" 9 "uuid:662a742b-fe6c-4852-a4a0-1c5f4f0182c3" "uuid:662a742b-fe6c-4852-a4a0-1c5f4f0182c3/Q201[4]"  "uuid:662a742b-fe6c-4852-a4a0-1c5f4f0182c3/Q201"
    end
    label values Q201b_GRPD labels0
    label def labels0 1 "0-5", modify
    label def labels0 3 "10-17", modify
    label def labels0 4 "18-24", modify
    label def labels0 5 "25-29", modify
    label def labels0 6 "30+", modify
    label values Q201c labels1
    label def labels1 1 "1. HH head", modify
    label def labels1 2 "2. Spouse", modify
    label def labels1 3 "3. Son/Daughter", modify
    label def labels1 4 "4. Other Relative", modify
    label def labels1 5 "5. Labourer", modify
    label def labels1 7 "7. Grand child", modify
    label values Q201d labels2
    label def labels2 1 "1. Yes", modify
    label def labels2 2 "2. No", modify
    label values Q201e labels3
    label def labels3 1 "1. Male", modify
    label def labels3 2 "2. Female", modify
    label values Q201f labels4
    label def labels4 1 "1. Never married/single", modify
    label def labels4 2 "2. Married/ cohabiting", modify
    label def labels4 3 "3. Separated/ Divorced", modify
    label def labels4 4 "4. Widowed", modify
    label values Q201g labels5
    label def labels5 1 "1. Yes", modify
    label def labels5 2 "2. No", modify
    label values Q201h labels6
    label def labels6 10 "10. Not of school going age", modify
    label def labels6 12 "12.       None/Unemployed", modify
    label def labels6 13 "13.       Boda boda / Taxi", modify
    label values Q201i labels7
    label def labels7 1 "1. None", modify
    label def labels7 2 "2. < Primary 3", modify
    label def labels7 3 "3. Primary 4-5", modify
    label def labels7 4 "4. Primary 6-7", modify
    label def labels7 5 "5. Senior 1-4", modify
    label def labels7 6 "6. Senior 5-6", modify
    label def labels7 9 "9. Not applicable", modify
    ------------------ copy up to and including the previous line ------------------

    Listed 100 out of 12213 observations
    Use the count() option to list more

    . sort PARENT_KEY

  • #2
    First of all, you need to identify what variable identifies a household. Then, the following Stata FAQ will be helpful in terms of how you formulate your conditions:

    https://www.stata.com/support/faqs/d...ble-recording/


    For example, if your household identifier is named "hhid" and the age variable (of the household members) is named "age", then

    1. Households with a child under five years
    2. Households with an elderly person (65 years and above)
    #1.
    Code:
    bysort hhid: egen wanted1= max(age<5)

    #2.
    Code:
    bysort hhid: egen wanted2= max(age>=65)
    From your data example, it is not apparent what your household identifier is and most members who are not familiar with your dataset will not bother helping you to find out. So if you struggle with this, find a colleague who is familiar with this dataset and has some experience with Stata to help you out.

    Comment


    • #3
      Hi Andrew,
      I appreciate your help. I have tried your tip, but still can't get it right. What your syntax shows me is which observation (family member) is meets a certain condition. In so doing, if I use "tab wanted1" to know which households have a child under the age of 5, the result shows me how many individuals are under 5 and those above as opposed to knowing the households with any member under the age of five and those without. In other words, a household where 3 people are under age five, the syntax above is counting all the three people instead of just once to show that the household meets the desired condition. It’s unfortunate that my household identifier is not clear, but for clarity, it is “PARENT_KEY” (I have attached my dataset impact_eval_Q201.dta just in case someone is willing to help out). As you can see, the PARENT_KEY is unique for each household. Thanks a lot

      Comment


      • #4
        In other words, a household where 3 people are under age five, the syntax above is counting all the three people instead of just once to show that the household meets the desired condition.

        After generating the wanted variable, tag one observation in each household and then tabulate the tagged observations.

        Code:
        egen tag= tag(PARENT_KEY)
        tab wanted1 if tag
        See

        Code:
        help egen

        Comment


        • #5
          Thanks a lot, Andrew, it worked. I will surely check out the help guide. There's definitely a lot to learn

          Comment

          Working...
          X