Announcement

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

  • Turning education into years of schooling

    Hello everyone,

    I currently have a categorical variable for education ( let's call it educ) which is divided into the following categories:

    ---------+-----------------------------------
    Degree | 1,415 33.36 33.36
    Other higher | 529 12.47 45.83
    A level etc | 769 18.13 63.96
    GCSE etc | 783 18.46 82.41
    Other qual | 416 9.81 92.22
    No qual

    I am trying to turn this into years of schooling (educ_n), but I am struggling.


    What I am trying to do is basically combine:
    GCSE, other qual and no qual and turn them into 0<years of schooling<12
    A level and other higher and turn them into 12=< years of schooling <13
    Degree years of schooling>=13

    My code is as follows so far:
    generate educ_n=.

    replace educ_n>0 & educ_n<=10 if educ==4&5&9

    but it says > is an invalid command.

    Could I please get some help?

  • #2
    Please read the FAQ. There you'll find how to share data/output/command so as they can be used to provide an insightful reply.

    That said, I recomend to use something like:

    Code:
    sysuse auto
    codebook foreign
    replace foreign = 10 if foreign == 0
    replace foreign = 20 if foreign == 1
    */ you may start from here
    tab foreign
    label define myvar 10 "Domestic" 20 "Foreign"
    label values foreign myvar
    tab foreign
    Shall you share data (use dataex for the matter), a precise strategy may be presented.
    Best regards,

    Marcos

    Comment


    • #3
      The question assumes familiarity with a British-style education system. For example, I have A-level Economics, Mathematics, Geography, General Studies but how many people here know what that means?

      Also, the goal is unclear as a numeric variable may hold a value but not an interval of values. Further

      Code:
      if educ == 4 & 5 & 9
      is never going to do what you want, as it is parsed as

      Code:
      if (educ == 4) & 5 & 9
      which is not what you want.

      I would leave this as an (almost) ordinal categorical variable myself. Too much guesswork required for anything else.

      Comment


      • #4
        Hi. I hope it is alright to post under this thread as I find it relatable to the question asked above. I am trying to create a categorical variable for different levels of education attainment (given number of people who completed different levels); have 5 categories (Notstated, primary, upper secondary, short-medium and long higher education) for both sex for two provinces (have 11 provinces in total) across 2013-2022. My question is, how do I approach this in the best possible?
        clear
        input int Year str3 Province long(PrimaryED_m UpperSecED_m SMhigherED_m LhigherED_m) int Notstated_m long(PrimaryED_f UpperSecED_f SMhigherED_f LhigherED_f) int Notstated_f
        2013 "PCC" 59217 99797 57179 50272 10702 51326 91462 79658 49153 9779
        2014 "PCC" 58174 99864 59867 53852 9581 49891 91180 82565 53490 8639
        2015 "PCC" 57243 99651 62760 58042 7601 48578 90917 85603 58145 6995
        2016 "PCC" 56689 98831 65680 62949 5049 47503 90418 88146 64711 4083
        2017 "PCC" 55907 98515 66651 66276 5008 46372 89991 88750 69266 4034
        2018 "PCC" 55191 98261 68063 69282 4894 45605 89703 90373 72771 3942
        2019 "PCC" 54661 98000 70481 71458 4889 44828 89741 91958 76143 3945
        2020 "PCC" 54300 97997 70900 72648 4794 44348 89716 91570 78369 3863
        2021 "PCC" 54116 97835 72013 74501 4805 43640 90059 91808 81175 3849
        2022 "PCC" 53323 97641 74768 76900 4805 42826 89992 94580 85023 3847
        2013 "PCA" 52556 72955 29326 22991 4861 48899 69211 42968 19621 4792
        2014 "PCA" 52052 73334 30105 24001 4429 47858 69080 44212 21031 4286
        2015 "PCA" 51610 72917 31057 25375 3846 46531 68783 45659 22520 3553
        2016 "PCA" 51021 72743 32370 26625 2922 45364 68286 46970 24125 2527
        2017 "PCA" 50484 72276 33136 27464 2898 44275 67527 47792 25442 2483
        2018 "PCA" 49814 71947 33723 27977 2888 43338 67040 48039 26498 2432
        2019 "PCA" 49183 71320 34591 28612 2896 42474 66335 48550 27620 2421
        2020 "PCA" 49084 70550 35019 29108 2887 41590 65355 48719 28662 2385
        2021 "PCA" 48980 70195 35931 30294 2874 41055 64358 49336 30274 2394
        2022 "PCA" 49104 70676 37810 31526 2938 40266 64584 51183 32041 2394
        end
        [/CODE]

        Comment


        • #5
          It would have been better if you posted a new question, as your question and the original question do not match.

          So your problem is that the unit of analysis is unclear. A row or observation in your dataset is a province-year-sex combination. You are however asking for a categorical variable, i.e. one variable that could take only one value per observation. All men in 2013 in PCC do not have the same education, so one value does not fit the data. A categorical value makes sense for individual level data, but not so for aggregate data like you have.
          ---------------------------------
          Maarten L. Buis
          University of Konstanz
          Department of history and sociology
          box 40
          78457 Konstanz
          Germany
          http://www.maartenbuis.nl
          ---------------------------------

          Comment


          • #6
            I apologise for the inconvenience (you are right, I should have started a new thread). Saying that, is there any other method to solve my problem?

            Comment


            • #7
              I have told you in #5 what your problem is, and that you need to make a choice. So making that choice is your first step. This is something you have to do, and not something I can do for you.
              ---------------------------------
              Maarten L. Buis
              University of Konstanz
              Department of history and sociology
              box 40
              78457 Konstanz
              Germany
              http://www.maartenbuis.nl
              ---------------------------------

              Comment


              • #8
                Thank you! I now understood what you meant.

                Comment

                Working...
                X