Announcement

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

  • #31
    The data set as imported is a bit messy. You have several variables that appear to be numeric in content but came in as strings. Based on the table you showed in #1, I have transformed those into value-labeled numeric variables. For labor status there was no crosswalk, so I have just left the string-numbers as is, but you should deal with this yourself. Categorical variables are usually easier to work with as value-labeled numeric variables than as strings. And strings like "1" etc. are particularly awkward.

    I still don't understand quite what comparisons you are trying to make, though at the very end of the code shown below I have given you an example of what I might do with this data that is along the lines of what you ask for as best I understand it. The bulk of the code, apart from data cleaning, involves associating parental data to the children. At the end you have a data set of all the children, with their father's and mother's attributes in their observations as well. I imagine you can take it from there.

    Code:
    destring sex, replace
    label define sex    1   "Male"  2   "Female"
    label values sex sex
    
    destring educationalqualification, replace
    label define educationalqualification   1  "Basic Qualification"   ///
                                            2   "Second Level"  ///
                                            3   "No Qualification"
    label values educationalqualification educationalqualification
    
    destring currentlyenrolledinschl, replace
    label define yesno  0   "No"    1   "Yes"
    label values currentlyenrolledinschl yesno
    
    destring relationship, replace
    label define relationship   1   "Head"  ///
                                2   "Spouse"    ///
                                3   "Child" ///
                                4   "Grandchild"
                                
    destring maritalstatus, replace
    label define maritalstatus  1   "Married"   ///
                                2   "???"   ///
                                3   "Divorced"  ///
                                4   "Widowed"   ///
                                5   "Never Married"
    label values maritalstatus maritalstatus
    
                                
    frame put hhnsrrno sex maritalstatus educationalqualification b5labour ///
        if inlist(relationship, 1, 2), into(parents)
    frame parents {
        by hhnsrrno (sex), sort: assert _N <= 2 // VERIFY AT MOST HEAD AND SPOUSE
        gen suffix = cond(sex == 1, "_father", "_mother")
        drop sex
        reshape wide maritalstatus educationalqualification b5labour, ///
            i(hhnsrrno) j(suffix) string
    }
    
    keep if relationship == 3 & inrange(age, 4, 28)
    frlink m:1 hhnsrrno, frame(parents)
    frget _all, from(parents)
    
    tab educationalqualification_father currentlyenrolledinschl, col

    Comment


    • #32
      Dear Clyde, thanks a lot for your help, PLEASE let me try to explain again, what I'm trying to achieve is to select all individuals that are not enrolled in school and without educational qualification, then select the heads of households of these individuals with the aim of analyzing the marital status and the nature of work of these heads of households to see if there's a link to their children/wards not being enrolled in school. i intend to do same analysis for individuals that are enrolled in school to compare. The frame command is not recognized by my Stata version perhaps its because I'm using Stata 15, secondly I'm still trying to understand the code you provided, grateful if you can break it down a bit more so i can understand the concept. or perhaps there's another way to tag these parents then extract? Thanks

      Comment


      • #33
        The Forum FAQ, which all members are supposed to have read before making their first post, advise that if you are not using the current version of Stata (which is now 17) you are supposed to say so in your post. That way you don't waste my time writing code you can't run, and you don't waste your own time trying unsuccessfully to run it and then having to post back for more help. You have correctly recognized that the -frame- commands were introduced after version 15.

        Anything that can be done with frames can also be done with tempfiles, though sometimes not as easily. So I have revised the code accordingly.

        In addition, you have in #32 changed the problem from matching up children's information with that of their parents (which, in most of the households, meant both a mother and a father) to matching up the information with that of the household head--of which there is only one. This considerably simplifies the code.

        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input str31 hhmnsrrno str28 hhnsrrno str4 hhno byte hhsize str2 mno str25 m_name str1 sex str2 relationship    byte agey str1 maritalstatus str2(b5labour    educationalqualification)    str1(currentlyenrolledinschl    chronicallyill)
        "SS/CR/AKA/AKAM ISLAND/1/0001/01" "SS/CR/AKA/AKAM ISLAND/1/0001" "0001"  5 "01" "NDIFON NTUI NTUI"    "1" "1"  20 "5" "6"  "6"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0001/02" "SS/CR/AKA/AKAM ISLAND/1/0001" "0001"  5 "02" "NDIFON NKOYO NTUI"    "2" "11" 16 "5" "13" "3"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0001/03" "SS/CR/AKA/AKAM ISLAND/1/0001" "0001"  5 "03" "EYANG OKPA ECHUR"    "2" "11" 20 "5" "6"  "6"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0001/04" "SS/CR/AKA/AKAM ISLAND/1/0001" "0001"  5 "04" "NDIFON OMOM NTUI"    "2" "11" 24 "5" "6"  "6"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0001/05" "SS/CR/AKA/AKAM ISLAND/1/0001" "0001"  5 "05" "NDIFON NTUI NDIFON"    "1" "11" 26 "5" "6"  "1"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0002/01" "SS/CR/AKA/AKAM ISLAND/1/0002" "0002"  5 "01" "EJOR ALEX BONNIFACE"    "1" "1"  25 "1" "6"  "6"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0002/02" "SS/CR/AKA/AKAM ISLAND/1/0002" "0002"  5 "02" "AMADU  EMMANUEL PATRICK"    "1" "11"  6 "5" "13" "1"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0002/03" "SS/CR/AKA/AKAM ISLAND/1/0002" "0002"  5 "03" "EYONG DAVID ESSIEN"    "1" "9"   5 "5" "8"  "1"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0002/04" "SS/CR/AKA/AKAM ISLAND/1/0002" "0002"  5 "04" "OMIN VALENTINE EFFIONG"    "1" "9"   6 "5" "13" "1"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0002/05" "SS/CR/AKA/AKAM ISLAND/1/0002" "0002"  5 "05" "AMADU RUTH PATRICK"    "2" "9"  15 "5" "8"  "2"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0003/01" "SS/CR/AKA/AKAM ISLAND/1/0003" "0003"  3 "01" "BASSEY GIFT BASSEY"    "2" "1"  21 "1" "8"  "6"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0003/02" "SS/CR/AKA/AKAM ISLAND/1/0003" "0003"  3 "02" "DANIEL OKON EYO"    "1" "11"  8 "5" "8"  "1"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0003/03" "SS/CR/AKA/AKAM ISLAND/1/0003" "0003"  3 "03" "OKON LAURA GODFREY"    "2" "11" 20 "5" "6"  "6"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0004/01" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "01" "MBOTO ROSE ABENG"    "2" "1"  54 "4" "6"  "1"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0004/02" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "02" "EDU DANIEL ENYA"    "1" "11" 57 "1" "6"  "10" "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0004/03" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "03" "MBOTO ABENG LAURA"    "2" "3"  20 "5" "8"  "6"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0004/04" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "04" "MBOTO ABENG EMMANUEL"    "1" "3"  11 "5" "8"  "1"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0004/05" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "05" "EDU PRECIOUS DANIEL"    "2" "3"  13 "5" "8"  "2"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0004/06" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "06" "EDU THOMPSON DANIEL"    "1" "3"  11 "5" "8"  "2"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0004/07" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "07" "ABENG MBOTO ALBERT"    "1" "3"  28 "5" "6"  "6"  "0" "1"
        "SS/CR/AKA/AKAM ISLAND/1/0004/08" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "08" "EDU GOODNESS DANIEL"    "2" "3"  16 "5" "8"  "3"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0004/09" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "09" "EDU ENINI DANIEL"    "1" "3"   7 "5" "8"  "1"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0004/10" "SS/CR/AKA/AKAM ISLAND/1/0004" "0004" 10 "10" "KELVIN DANIEL EDU"    "1" "3"  17 "5" "13" "3"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0005/01" "SS/CR/AKA/AKAM ISLAND/1/0005" "0005"  5 "01" "OGAR AGU THERESA"    "2" "1"  60 "4" "6"  "1"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0005/02" "SS/CR/AKA/AKAM ISLAND/1/0005" "0005"  5 "02" "IKPEMBE MIRIAM EMMANUEL"    "2" "4"   4 "5" ""   "1"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0005/03" "SS/CR/AKA/AKAM ISLAND/1/0005" "0005"  5 "03" "IKPEMBE PROMISE EMMANUEL"    "1" "4"  12 "5" "8"  "2"  "1" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0005/04" "SS/CR/AKA/AKAM ISLAND/1/0005" "0005"  5 "04" "IKPEMBE THOMAS EMMANUEL"    "1" "6"  31 "1" "6"  "1"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0005/05" "SS/CR/AKA/AKAM ISLAND/1/0005" "0005"  5 "05" "RORIM KOKOMA EBANI"    "2" "6"  26 "1" "12" "1"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0006/01" "SS/CR/AKA/AKAM ISLAND/1/0006" "0006"  5 "01" "OJONG EMMANUELA OKORN"    "2" "1"  47 "4" "6"  "6"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0006/02" "SS/CR/AKA/AKAM ISLAND/1/0006" "0006"  5 "02" "PAUL OKORN OJONG"    "1" "3"  31 "5" "6"  "6"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0006/03" "SS/CR/AKA/AKAM ISLAND/1/0006" "0006"  5 "03" "VIVIAN OKORN OJONG"    "2" "3"  35 "1" "6"  "12" "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0006/04" "SS/CR/AKA/AKAM ISLAND/1/0006" "0006"  5 "04" "JENNIFER OKORN OJONG"    "2" "3"  19 "5" "6"  "6"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0006/05" "SS/CR/AKA/AKAM ISLAND/1/0006" "0006"  5 "05" "VIOLET OKORN OJONG"    "2" "3"  24 "1" "6"  "6"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0009/01" "SS/CR/AKA/AKAM ISLAND/1/0009" "0009"  8 "01" "ITA BASSEY VALENTINE"    "2" "1"  50 "4" "6"  "2"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0009/02" "SS/CR/AKA/AKAM ISLAND/1/0009" "0009"  8 "02" "ITA SOLOMON VALENTINE"    "1" "3"  13 "5" "13" "2"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0009/03" "SS/CR/AKA/AKAM ISLAND/1/0009" "0009"  8 "03" "ITA NSIKAN GABRIEL"    "2" "3"  35 "1" "6"  "1"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0009/04" "SS/CR/AKA/AKAM ISLAND/1/0009" "0009"  8 "04" "ITA EFFIONG VALENTINE"    "1" "3"  14 "5" "13" "2"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0009/05" "SS/CR/AKA/AKAM ISLAND/1/0009" "0009"  8 "05" "ITA CHRISTOPHER VALENTINE"    "1" "3"  10 "5" "13" "2"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0009/06" "SS/CR/AKA/AKAM ISLAND/1/0009" "0009"  8 "06" "ITA VALENTINE EKUBE"    "1" "3"  16 "5" "13" "2"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0009/07" "SS/CR/AKA/AKAM ISLAND/1/0009" "0009"  8 "07" "ITA GABRIEL MICHAEL"    "1" "4"  17 "5" "13" "3"  "0" "0"
        "SS/CR/AKA/AKAM ISLAND/1/0009/08" "SS/CR/AKA/AKAM ISLAND/1/0009" "0009"  8 "08" "ITA ESTHER GABRIEL"    "2" "4"  13 "5" "8"  "3"  "1" "0"
        "SS/CR/CSG/AKANI/1/0015/01"       "SS/CR/CSG/AKANI/1/0015"       "0015"  3 "01" "EKPE EDAK ESSIEN"    "2" "1"  45 "2" "6"  "2"  "0" "0"
        "SS/CR/CSG/AKANI/1/0015/02"       "SS/CR/CSG/AKANI/1/0015"       "0015"  3 "02" "ABO CHARLES ETIM"    "1" "3"  27 "5" "6"  "6"  "0" "0"
        "SS/CR/CSG/AKANI/1/0015/03"       "SS/CR/CSG/AKANI/1/0015"       "0015"  3 "03" "ABO EMMANUEL ETIM"    "1" "3"  29 "5" "6"  "6"  "0" "0"
        "SS/CR/CSG/AKANI/1/0017/01"       "SS/CR/CSG/AKANI/1/0017"       "0017"  6 "01" "EBITO ANGELA EDET"    "2" "1"  50 "4" "6"  "1"  "0" "0"
        "SS/CR/CSG/AKANI/1/0017/02"       "SS/CR/CSG/AKANI/1/0017"       "0017"  6 "02" "EBITO JOSEPH EDET "    "1" "3"  21 "5" "6"  "6"  "0" "0"
        "SS/CR/CSG/AKANI/1/0017/03"       "SS/CR/CSG/AKANI/1/0017"       "0017"  6 "03" "EBITO IKWO EDET"    "2" "3"  30 "5" "6"  "6"  "0" "0"
        "SS/CR/CSG/AKANI/1/0017/04"       "SS/CR/CSG/AKANI/1/0017"       "0017"  6 "04" "EBITO NKOYO EDET"    "2" "3"  32 "5" "6"  "6"  "0" "0"
        "SS/CR/CSG/AKANI/1/0017/05"       "SS/CR/CSG/AKANI/1/0017"       "0017"  6 "05" "FRED JOSEPH AYASA "    "1" "4"   9 "5" "8"  "1"  "1" "0"
        "SS/CR/CSG/AKANI/1/0017/06"       "SS/CR/CSG/AKANI/1/0017"       "0017"  6 "06" "EBITAGHA SAVIOUR "    "1" "4"  19 "5" "6"  "6"  "0" "0"
        "SS/CR/CSG/AKANI/1/0019/01"       "SS/CR/CSG/AKANI/1/0019"       "0019"  7 "01" "EWA EMMANUEL EFFIOM"    "1" "1"  39 "2" "6"  "2"  "0" "0"
        "SS/CR/CSG/AKANI/1/0019/02"       "SS/CR/CSG/AKANI/1/0019"       "0019"  7 "02" "PETER MERCY"    "2" "10" 35 "5" "6"  "1"  "0" "0"
        "SS/CR/CSG/AKANI/1/0019/03"       "SS/CR/CSG/AKANI/1/0019"       "0019"  7 "03" "EWA GLORY"    "2" "10"  2 "5" ""   "1"  "0" "0"
        "SS/CR/CSG/AKANI/1/0019/04"       "SS/CR/CSG/AKANI/1/0019"       "0019"  7 "04" "EWA MARGARET"    "2" "10"  6 "5" "8"  "1"  "1" "0"
        "SS/CR/CSG/AKANI/1/0019/05"       "SS/CR/CSG/AKANI/1/0019"       "0019"  7 "05" "EFFIOM LINDA EMMANUEL"    "2" "3"   8 "5" "8"  "1"  "1" "0"
        "SS/CR/CSG/AKANI/1/0019/06"       "SS/CR/CSG/AKANI/1/0019"       "0019"  7 "06" "EFFIOM EMMANULLA EMMANUEL"    "2" "3"  10 "5" "8"  "1"  "1" "0"
        "SS/CR/CSG/AKANI/1/0019/07"       "SS/CR/CSG/AKANI/1/0019"       "0019"  7 "07" "IJUMA ISAIAH CHRISTIAN"    "1" "3"   5 "5" "8"  "1"  "1" "0"
        "SS/CR/CSG/AKANI/1/0020/01"       "SS/CR/CSG/AKANI/1/0020"       "0020"  4 "01" "NSA ELIZABETH EYO"    "2" "1"  45 "4" "6"  "6"  "0" "0"
        "SS/CR/CSG/AKANI/1/0020/02"       "SS/CR/CSG/AKANI/1/0020"       "0020"  4 "02" "NSA MARY EYO"    "2" "11" 39 "5" "6"  "9"  "0" "0"
        "SS/CR/CSG/AKANI/1/0020/03"       "SS/CR/CSG/AKANI/1/0020"       "0020"  4 "03" "OKON EKANEM EYO"    "2" "3"  27 "5" "6"  "6"  "0" "0"
        "SS/CR/CSG/AKANI/1/0020/04"       "SS/CR/CSG/AKANI/1/0020"       "0020"  4 "04" "NSA GLORY EYO"    "2" "3"  17 "5" "13" "2"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0034/01"       "SS/CR/IKM/BOGHA/2/0034"       "0034"  8 "01" "EYAM DARLINGTON NKWAM"    "1" "1"  40 "1" "4"  "2"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0034/02"       "SS/CR/IKM/BOGHA/2/0034"       "0034"  8 "02" "NKWAM OGBINA"    "2" "11" 21 "5" "2"  "2"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0034/03"       "SS/CR/IKM/BOGHA/2/0034"       "0034"  8 "03" "NKWAM ENDURANCE"    "2" "11" 19 "5" "6"  "3"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0034/04"       "SS/CR/IKM/BOGHA/2/0034"       "0034"  8 "04" "NKWAM MERCY"    "2" "11" 17 "5" "12" "2"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0034/05"       "SS/CR/IKM/BOGHA/2/0034"       "0034"  8 "05" "NKWAM MARCUS"    "1" "11" 42 "1" "13" "3"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0034/06"       "SS/CR/IKM/BOGHA/2/0034"       "0034"  8 "06" "NKWAM ANGELA"    "2" "2"  37 "1" "4"  "2"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0034/07"       "SS/CR/IKM/BOGHA/2/0034"       "0034"  8 "07" "NKWAM VICTORY"    "1" "3"   9 "5" "8"  "1"  "1" "0"
        "SS/CR/IKM/BOGHA/2/0034/08"       "SS/CR/IKM/BOGHA/2/0034"       "0034"  8 "08" "NKWAM WINNER"    "2" "3"   5 "5" "8"  "1"  "1" "0"
        "SS/CR/IKM/BOGHA/2/0040/01"       "SS/CR/IKM/BOGHA/2/0040"       "0040"  4 "01" "ODIGHA LIVINUS "    "1" "1"  69 "2" "13" "1"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0040/02"       "SS/CR/IKM/BOGHA/2/0040"       "0040"  4 "02" "ENONO KINGSLEY ODIGHA"    "1" "3"  34 "5" "6"  "1"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0040/03"       "SS/CR/IKM/BOGHA/2/0040"       "0040"  4 "03" "ODIGHA ETITAH"    "2" "3"  24 "5" "6"  "1"  "0" "0"
        "SS/CR/IKM/BOGHA/2/0040/04"       "SS/CR/IKM/BOGHA/2/0040"       "0040"  4 "04" "ODIGHA OGONYI"    "2" "3"  29 "5" "6"  "1"  "0" "0"
        end
        
        //  MAKE THE QUANTITATIVE VARIABLES THAT ARE REPRESENTED AS STRINGS
        //  INTO VALUE LABELED NUMERIC VARIABLES
        destring sex, replace
        label define sex    1   "Male"  2   "Female"
        label values sex sex
        
        destring educationalqualification, replace
        label define educationalqualification   1  "Basic Qualification"   ///
                                                2   "Second Level"  ///
                                                3   "No Qualification"
        label values educationalqualification educationalqualification
        
        destring currentlyenrolledinschl, replace
        label define yesno  0   "No"    1   "Yes"
        label values currentlyenrolledinschl yesno
        
        destring relationship, replace
        label define relationship   1   "Head"  ///
                                    2   "Spouse"    ///
                                    3   "Child" ///
                                    4   "Grandchild"
                                    
        destring maritalstatus, replace
        label define maritalstatus  1   "Married"   ///
                                    2   "???"   ///
                                    3   "Divorced"  ///
                                    4   "Widowed"   ///
                                    5   "Never Married"
        label values maritalstatus maritalstatus
        
        // CREATE A DATA SET OF HEADS OF HOUSEHOLDS
        preserve
        keep if relationship == 1
        keep hhnsrrno sex maritalstatus educationalqualification b5labour
        by hhnsrrno, sort: assert _N == 1 // VERIFY ONLY ONE HEAD IN EACH HOUSEHOLD
        rename (sex maritalstatus educationalqualification b5labour) head_=                        
        tempfile heads
        save `heads'
                                    
        
        //  BRING BACK ORIGINAL DATA AND REMOVE THOSE WHO AREN'T CHILDREN
        restore
        keep if relationship == 3 & inrange(age, 4, 28)
        
        //  LINK THE CHILDREN'S DATA TO THAT OF THEIR HOUSEHOLDS' HEADS
        merge m:1 hhnsrrno using `heads'
        The first part of the code just takes the categorical variables that have been represented as strings in your data set and converts them into numeric variables with value labels. Numeric variables are easier to work with in Stata and usually take less memory. The conversion is necessarily incomplete here because some of the numeric values in the example data you provided do not appear in what you first showed in your original post, and therefore lack a translation into words. If you are not familiar with value labeled numeric variables, then I strongly recommend you go back and read the User's Guide [U] volume of the PDF documentation that is installed with your Stata. It is a general tour of the Stata basics, and familiarity with its contents will not only make you more productive working with Stata but will enable you to work with Statalist more efficiently. While it's a bit of reading, the time invested will be rapidly repaid.

        The second part of the code creates a new dataset, stored in a tempfile named `heads', the contains the sex, marital status, education, and labor variables for the heads of each household.

        The third part of the code brings the original data back into memory, and then reduces it to those whose relationship is "Child" and are between ages 4 and 28. Finally, this data set is merged with the household head data set previously created so that every observation now consists of the information of a child between the ages of 4 and 28 and the sex, marital status, education, and labor variables for the head of the child's household. From there you should be able to do comparisons about the attributes of the household heads of children who are and aren't in school. For example, you could run
        Code:
        tab head_educationalqualification currentlyenrolledinschl, col
        to compare the educational qualifications of the household heads whose child is enrolled in school with the educational qualifications of the household heaads whose child is not. This analysis is, perhaps, oversimplified in that the same household head might have both children who are and children who arenot enrolled. So more sophisticated approaches may be needed, and this example is only intended to illustrate the simplest first-cut at the data.



        Comment


        • #34
          Thanks Clyde, your codes and explanations have been very helpful. You have also made a critical observation that i need to consider.

          Comment

          Working...
          X