Announcement

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

  • Problems with cleaning panel data

    Hello, everyone

    I am seeking help with how I might be able to clean the panel data. The data is from China Family Panel Studies (CFPS) and I am trying to study a problem related to parents and children. Below is a simplified table taken from the original dataset as an example:
    pid fid code_c1 birthy_c1 birthm_c1 gender_c1 code_c2 birthy_c2 birthm_c2 gender_c2 code_c3 birthy_c3 birthm_c3 gender_c3 code_c4 birthy_c4 birthm_c4 gender_c4 code_c5 birthy_c5 birthm_c5 gender_c5
    410568105 108998 205 1969 1 0 206 1971 5 0 207 1972 3 1 208 1966 7 1 102 1966 7 0
    100435552 100435 102 1952 11 1 208 1954 12 0 206 1954 1 . 207 1957 9 0 205 1956 . 1
    100879601 100879 101 1968 3 1 207 . 6 1 209 . . 0 210 1971 4 . . . . .
    Let me briefly explain this example:
    In this case, there are three people which pid=personal ID. Each of them belongs to a certain family where fid=family ID. The first two of them have five children, and the last one only has four children (in the original dataset, the number of children varies from 0-10). For each child, they have a personal ID code (code_c#), information on their birth year (birthy_c#), their birth month (birthm_c#), and their gender (gender_c#). If the content of a cell is a dot, that means lack of information because they don't know/they don't want to answer/the case is not suitable. Also, for gender, 0=female and 1=male. We can also see that there is often a lack of data where there should be information.
    The biggest problem with the original data is, these children (child_c1,child_c2,child_c3,child_c4,child_c5) are not in an order in any way. I would wish for them to be able to be ordered according to age from small to big, so that I would be able to gain information on the gap between two births and problems related to hidden gender preference.

    Here is an ideal form of the above table manually altered by me:
    pid fid code_c1 birthy_c1 birthm_c1 gender_c1 code_c2 birthy_c2 birthm_c2 gender_c2 code_c3 birthy_c3 birthm_c3 gender_c3 code_c4 birthy_c4 birthm_c4 gender_c4 code_c5 birthy_c5 birthm_c5 gender_c5
    410568105 108998 102 1966 7 0 208 1966 7 1 205 1969 1 0 206 1971 5 0 207 1972 3 1
    100435552 100435 102 1952 11 1 208 1954 1 . 206 1954 12 0 205 1957 . 1 207 1956 9 0
    100879601 100879 101 1968 3 1 210 1971 4 . 207 . 6 1 209 . . 0 . . . .
    My ideal format is that the children can be ordered according to first birth year and then birth month from small to big, and that the information of their personal id (code_c#) and gender and also move along with them.
    The difficulty id first that I am not sure if there is a command in Stata that can swap the data in two cells. In addition, the command as far as I know from searching on the internet can only able me to move a column as a whole, but cannot treat the columns of each row individually. Furthermore, I am not sure how I can enable the information of a child to move with the birth year and birth month.

    It would be of a million thanks if there is a way to solve this issue

  • #2
    Please use dataex to show an example of your data so someone can help you. While you're at it, please read the FAQ.

    This may just be a reshape thing, but I will not make any diagnoses about the issue until I can work with a sample of the dataset you have.

    Welcome to Statalist, Xuan.

    Comment


    • #3
      Hi,

      Thank you so much for offering to help and sorry I did not read the FAQ beforehand so did not know about dataex. Below is the sample exported from dataex:

      clear
      input double(pid fid code_c1 gender_c1 birthyear_c1 birthmonth_c1 code_c2 gender_c2 birthyear_c2 birthmonth_c2 code_c3 gender_c3 birthyear_c3 birthmonth_c3)
      110001101 110001 203 1 . . . . . . . . . .
      110001102 110001 . . . . . . . . . . . .
      110002101 110002 103 0 . . . . . . . . . .
      110002102 110002 103 0 . . . . . . . . . .
      110002103 110002 . . . . . . . . . . . .
      110003101 110003 103 0 1997 1 . . . . . . . .
      110003102 110003 103 0 1997 1 . . . . . . . .
      110003103 110003 . . . . . . . . . . . .
      110005101 110005 . . . . . . . . . . . .
      110005102 110005 101 0 1991 1 . . . . . . . .
      110005103 110005 101 0 1991 1 . . . . . . . .
      110005104 110005 102 1 1962 10 206 1 1959 11 207 0 1958 .
      110006101 110006 103 0 1990 5 . . . . . . . .
      110006102 110006 103 0 1990 5 . . . . . . . .
      110006103 110006 . . . . . . . . . . . .
      110007101 110007 . . . . . . . . . . . .
      110007102 110007 101 0 1986 10 103 1 1990 1 . . . .
      110007103 110007 . . . . . . . . . . . .
      110007104 110007 101 0 1986 10 103 1 1990 1 . . . .
      110009101 110009 103 0 . . 102 1 . . . . . .
      110009102 110009 105 1 . . . . . . . . . .
      110009103 110009 107 1 . . . . . . . . . .
      110009104 110009 105 1 . . . . . . . . . .
      110009105 110009 . . . . . . . . . . . .
      110009106 110009 107 1 . . . . . . . . . .
      110009107 110009 . . . . . . . . . . . .
      110010101 110010 203 0 1975 8 . . . . . . . .
      110011101 110011 103 0 1999 7 104 0 2001 6 105 1 2006 9
      110011102 110011 103 0 1999 7 104 0 2001 6 105 1 2006 9
      110011103 110011 . . . . . . . . . . . .
      110011104 110011 . . . . . . . . . . . .
      110011105 110011 . . . . . . . . . . . .
      110013101 110013 103 1 1994 10 . . . . . . . .
      110013102 110013 103 1 1994 10 . . . . . . . .
      110013103 110013 . . . . . . . . . . . .
      110015101 110015 107 1 1988 10 . . . . . . . .
      110015102 110015 103 1 1959 11 104 1 1965 1 . . . .
      110015103 110015 106 0 1986 7 . . . . . . . .
      110015104 110015 107 1 1988 10 . . . . . . . .
      110015105 110015 106 0 1986 7 . . . . . . . .
      110015106 110015 . . . . . . . . . . . .
      110015107 110015 . . . . . . . . . . . .
      110019101 110019 105 0 1998 2 106 0 2002 10 107 1 2005 8
      110019102 110019 203 1 1973 9 104 0 1972 12 . . . .
      110019103 110019 203 1 1973 9 104 0 1972 12 . . . .
      110019104 110019 105 0 1998 2 106 0 2002 10 107 1 2005 8
      110019105 110019 . . . . . . . . . . . .
      110019106 110019 . . . . . . . . . . . .
      110019107 110019 . . . . . . . . . . . .
      110020101 110020 103 1 1968 11 104 1 1974 1 . . . .
      end
      label values pid pid
      label values fid fid
      label values code_c1 code_a_c1
      label values gender_c1 tb2_a_c1
      label def tb2_a_c1 0 "女", modify
      label def tb2_a_c1 1 "男", modify
      label values birthyear_c1 tb1y_a_c1
      label values birthmonth_c1 tb1m_a_c1
      label values code_c2 code_a_c2
      label values gender_c2 tb2_a_c2
      label def tb2_a_c2 0 "女", modify
      label def tb2_a_c2 1 "男", modify
      label values birthyear_c2 tb1y_a_c2
      label values birthmonth_c2 tb1m_a_c2
      label values code_c3 code_a_c3
      label values gender_c3 tb2_a_c3
      label def tb2_a_c3 0 "女", modify
      label def tb2_a_c3 1 "男", modify
      label values birthyear_c3 tb1y_a_c3
      label values birthmonth_c3 tb1m_a_c3

      As the labels might involve Chinese, any confusions can refer to the explanations above, or ask me here.

      It would really of great help if anybody can help fix this issue, which is quite important for relevant study. Thank you very much!

      Comment


      • #4
        It is challenging to envision conducting any analysis with the data in wide layout. Once you reshape long your dataset, achieving the desired order becomes straightforward.

        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input double(pid fid code_c1 gender_c1 birthyear_c1 birthmonth_c1 code_c2 gender_c2 birthyear_c2 birthmonth_c2 code_c3 gender_c3 birthyear_c3 birthmonth_c3)
        110001101 110001 203 1    .  .   . .    .  .   . .    . .
        110001102 110001   . .    .  .   . .    .  .   . .    . .
        110002101 110002 103 0    .  .   . .    .  .   . .    . .
        110002102 110002 103 0    .  .   . .    .  .   . .    . .
        110002103 110002   . .    .  .   . .    .  .   . .    . .
        110003101 110003 103 0 1997  1   . .    .  .   . .    . .
        110003102 110003 103 0 1997  1   . .    .  .   . .    . .
        110003103 110003   . .    .  .   . .    .  .   . .    . .
        110005101 110005   . .    .  .   . .    .  .   . .    . .
        110005102 110005 101 0 1991  1   . .    .  .   . .    . .
        110005103 110005 101 0 1991  1   . .    .  .   . .    . .
        110005104 110005 102 1 1962 10 206 1 1959 11 207 0 1958 .
        110006101 110006 103 0 1990  5   . .    .  .   . .    . .
        110006102 110006 103 0 1990  5   . .    .  .   . .    . .
        110006103 110006   . .    .  .   . .    .  .   . .    . .
        110007101 110007   . .    .  .   . .    .  .   . .    . .
        110007102 110007 101 0 1986 10 103 1 1990  1   . .    . .
        110007103 110007   . .    .  .   . .    .  .   . .    . .
        110007104 110007 101 0 1986 10 103 1 1990  1   . .    . .
        110009101 110009 103 0    .  . 102 1    .  .   . .    . .
        110009102 110009 105 1    .  .   . .    .  .   . .    . .
        110009103 110009 107 1    .  .   . .    .  .   . .    . .
        110009104 110009 105 1    .  .   . .    .  .   . .    . .
        110009105 110009   . .    .  .   . .    .  .   . .    . .
        110009106 110009 107 1    .  .   . .    .  .   . .    . .
        110009107 110009   . .    .  .   . .    .  .   . .    . .
        110010101 110010 203 0 1975  8   . .    .  .   . .    . .
        110011101 110011 103 0 1999  7 104 0 2001  6 105 1 2006 9
        110011102 110011 103 0 1999  7 104 0 2001  6 105 1 2006 9
        110011103 110011   . .    .  .   . .    .  .   . .    . .
        110011104 110011   . .    .  .   . .    .  .   . .    . .
        110011105 110011   . .    .  .   . .    .  .   . .    . .
        110013101 110013 103 1 1994 10   . .    .  .   . .    . .
        110013102 110013 103 1 1994 10   . .    .  .   . .    . .
        110013103 110013   . .    .  .   . .    .  .   . .    . .
        110015101 110015 107 1 1988 10   . .    .  .   . .    . .
        110015102 110015 103 1 1959 11 104 1 1965  1   . .    . .
        110015103 110015 106 0 1986  7   . .    .  .   . .    . .
        110015104 110015 107 1 1988 10   . .    .  .   . .    . .
        110015105 110015 106 0 1986  7   . .    .  .   . .    . .
        110015106 110015   . .    .  .   . .    .  .   . .    . .
        110015107 110015   . .    .  .   . .    .  .   . .    . .
        110019101 110019 105 0 1998  2 106 0 2002 10 107 1 2005 8
        110019102 110019 203 1 1973  9 104 0 1972 12   . .    . .
        110019103 110019 203 1 1973  9 104 0 1972 12   . .    . .
        110019104 110019 105 0 1998  2 106 0 2002 10 107 1 2005 8
        110019105 110019   . .    .  .   . .    .  .   . .    . .
        110019106 110019   . .    .  .   . .    .  .   . .    . .
        110019107 110019   . .    .  .   . .    .  .   . .    . .
        110020101 110020 103 1 1968 11 104 1 1974  1   . .    . .
        end
        label values pid pid
        label values fid fid
        label values code_c1 code_a_c1
        label values gender_c1 tb2_a_c1
        label def tb2_a_c1 0 "女", modify
        label def tb2_a_c1 1 "男", modify
        label values birthyear_c1 tb1y_a_c1
        label values birthmonth_c1 tb1m_a_c1
        label values code_c2 code_a_c2
        label values gender_c2 tb2_a_c2
        label def tb2_a_c2 0 "女", modify
        label def tb2_a_c2 1 "男", modify
        label values birthyear_c2 tb1y_a_c2
        label values birthmonth_c2 tb1m_a_c2
        label values code_c3 code_a_c3
        label values gender_c3 tb2_a_c3
        label def tb2_a_c3 0 "女", modify
        label def tb2_a_c3 1 "男", modify
        label values birthyear_c3 tb1y_a_c3
        label values birthmonth_c3 tb1m_a_c3
        
        reshape long code_c gender_c birthyear_c birthmonth_c, i(pid) j(order)
        drop if missing(code_c)
        gsort fid -birthyear_c -birthmonth_c
        by fid: replace order=_n
        Res.:

        Code:
        . l, sepby(fid)
        
             +----------------------------------------------------------------------+
             |       pid   order      fid   code_c   gender_c   birthy~c   birthm~c |
             |----------------------------------------------------------------------|
          1. | 1.100e+08       1   110001      203         男          .          . |
             |----------------------------------------------------------------------|
          2. | 1.100e+08       1   110002      103         女          .          . |
          3. | 1.100e+08       2   110002      103         女          .          . |
             |----------------------------------------------------------------------|
          4. | 1.100e+08       1   110003      103         女       1997          1 |
          5. | 1.100e+08       2   110003      103         女       1997          1 |
             |----------------------------------------------------------------------|
          6. | 1.100e+08       1   110005      101         女       1991          1 |
          7. | 1.100e+08       2   110005      101         女       1991          1 |
          8. | 1.100e+08       3   110005      102         男       1962         10 |
          9. | 1.100e+08       4   110005      206         男       1959         11 |
         10. | 1.100e+08       5   110005      207         女       1958          . |
             |----------------------------------------------------------------------|
         11. | 1.100e+08       1   110006      103         女       1990          5 |
         12. | 1.100e+08       2   110006      103         女       1990          5 |
             |----------------------------------------------------------------------|
         13. | 1.100e+08       1   110007      103         男       1990          1 |
         14. | 1.100e+08       2   110007      103         男       1990          1 |
         15. | 1.100e+08       3   110007      101         女       1986         10 |
         16. | 1.100e+08       4   110007      101         女       1986         10 |
             |----------------------------------------------------------------------|
         17. | 1.100e+08       1   110009      107         男          .          . |
         18. | 1.100e+08       2   110009      103         女          .          . |
         19. | 1.100e+08       3   110009      102         男          .          . |
         20. | 1.100e+08       4   110009      105         男          .          . |
         21. | 1.100e+08       5   110009      105         男          .          . |
         22. | 1.100e+08       6   110009      107         男          .          . |
             |----------------------------------------------------------------------|
         23. | 1.100e+08       1   110010      203         女       1975          8 |
             |----------------------------------------------------------------------|
         24. | 1.100e+08       1   110011      105         男       2006          9 |
         25. | 1.100e+08       2   110011      105         男       2006          9 |
         26. | 1.100e+08       3   110011      104         女       2001          6 |
         27. | 1.100e+08       4   110011      104         女       2001          6 |
         28. | 1.100e+08       5   110011      103         女       1999          7 |
         29. | 1.100e+08       6   110011      103         女       1999          7 |
             |----------------------------------------------------------------------|
         30. | 1.100e+08       1   110013      103         男       1994         10 |
         31. | 1.100e+08       2   110013      103         男       1994         10 |
             |----------------------------------------------------------------------|
         32. | 1.100e+08       1   110015      107         男       1988         10 |
         33. | 1.100e+08       2   110015      107         男       1988         10 |
         34. | 1.100e+08       3   110015      106         女       1986          7 |
         35. | 1.100e+08       4   110015      106         女       1986          7 |
         36. | 1.100e+08       5   110015      104         男       1965          1 |
         37. | 1.100e+08       6   110015      103         男       1959         11 |
             |----------------------------------------------------------------------|
         38. | 1.100e+08       1   110019      107         男       2005          8 |
         39. | 1.100e+08       2   110019      107         男       2005          8 |
         40. | 1.100e+08       3   110019      106         女       2002         10 |
         41. | 1.100e+08       4   110019      106         女       2002         10 |
         42. | 1.100e+08       5   110019      105         女       1998          2 |
         43. | 1.100e+08       6   110019      105         女       1998          2 |
         44. | 1.100e+08       7   110019      203         男       1973          9 |
         45. | 1.100e+08       8   110019      203         男       1973          9 |
         46. | 1.100e+08       9   110019      104         女       1972         12 |
         47. | 1.100e+08      10   110019      104         女       1972         12 |
             |----------------------------------------------------------------------|
         48. | 1.100e+08       1   110020      104         男       1974          1 |
         49. | 1.100e+08       2   110020      103         男       1968         11 |
             +----------------------------------------------------------------------+

        Comment


        • #5
          Thank you so much for the solution! I will try to see if it works

          Comment


          • #6
            Hi! I have another small problem. Is it possible that after being ordered like above, I can change the style into the original wide layout with all information of the children after their parent but only with the right order, with a command of some kind? This is because I might also have to consider merge this with other related factors using pid. Thank you very much

            Comment


            • #7
              Originally posted by Andrew Musau View Post
              It is challenging to envision conducting any analysis with the data in wide layout. Once you reshape long your dataset, achieving the desired order becomes straightforward.

              Code:
              * Example generated by -dataex-. For more info, type help dataex
              clear
              input double(pid fid code_c1 gender_c1 birthyear_c1 birthmonth_c1 code_c2 gender_c2 birthyear_c2 birthmonth_c2 code_c3 gender_c3 birthyear_c3 birthmonth_c3)
              110001101 110001 203 1 . . . . . . . . . .
              110001102 110001 . . . . . . . . . . . .
              110002101 110002 103 0 . . . . . . . . . .
              110002102 110002 103 0 . . . . . . . . . .
              110002103 110002 . . . . . . . . . . . .
              110003101 110003 103 0 1997 1 . . . . . . . .
              110003102 110003 103 0 1997 1 . . . . . . . .
              110003103 110003 . . . . . . . . . . . .
              110005101 110005 . . . . . . . . . . . .
              110005102 110005 101 0 1991 1 . . . . . . . .
              110005103 110005 101 0 1991 1 . . . . . . . .
              110005104 110005 102 1 1962 10 206 1 1959 11 207 0 1958 .
              110006101 110006 103 0 1990 5 . . . . . . . .
              110006102 110006 103 0 1990 5 . . . . . . . .
              110006103 110006 . . . . . . . . . . . .
              110007101 110007 . . . . . . . . . . . .
              110007102 110007 101 0 1986 10 103 1 1990 1 . . . .
              110007103 110007 . . . . . . . . . . . .
              110007104 110007 101 0 1986 10 103 1 1990 1 . . . .
              110009101 110009 103 0 . . 102 1 . . . . . .
              110009102 110009 105 1 . . . . . . . . . .
              110009103 110009 107 1 . . . . . . . . . .
              110009104 110009 105 1 . . . . . . . . . .
              110009105 110009 . . . . . . . . . . . .
              110009106 110009 107 1 . . . . . . . . . .
              110009107 110009 . . . . . . . . . . . .
              110010101 110010 203 0 1975 8 . . . . . . . .
              110011101 110011 103 0 1999 7 104 0 2001 6 105 1 2006 9
              110011102 110011 103 0 1999 7 104 0 2001 6 105 1 2006 9
              110011103 110011 . . . . . . . . . . . .
              110011104 110011 . . . . . . . . . . . .
              110011105 110011 . . . . . . . . . . . .
              110013101 110013 103 1 1994 10 . . . . . . . .
              110013102 110013 103 1 1994 10 . . . . . . . .
              110013103 110013 . . . . . . . . . . . .
              110015101 110015 107 1 1988 10 . . . . . . . .
              110015102 110015 103 1 1959 11 104 1 1965 1 . . . .
              110015103 110015 106 0 1986 7 . . . . . . . .
              110015104 110015 107 1 1988 10 . . . . . . . .
              110015105 110015 106 0 1986 7 . . . . . . . .
              110015106 110015 . . . . . . . . . . . .
              110015107 110015 . . . . . . . . . . . .
              110019101 110019 105 0 1998 2 106 0 2002 10 107 1 2005 8
              110019102 110019 203 1 1973 9 104 0 1972 12 . . . .
              110019103 110019 203 1 1973 9 104 0 1972 12 . . . .
              110019104 110019 105 0 1998 2 106 0 2002 10 107 1 2005 8
              110019105 110019 . . . . . . . . . . . .
              110019106 110019 . . . . . . . . . . . .
              110019107 110019 . . . . . . . . . . . .
              110020101 110020 103 1 1968 11 104 1 1974 1 . . . .
              end
              label values pid pid
              label values fid fid
              label values code_c1 code_a_c1
              label values gender_c1 tb2_a_c1
              label def tb2_a_c1 0 "女", modify
              label def tb2_a_c1 1 "男", modify
              label values birthyear_c1 tb1y_a_c1
              label values birthmonth_c1 tb1m_a_c1
              label values code_c2 code_a_c2
              label values gender_c2 tb2_a_c2
              label def tb2_a_c2 0 "女", modify
              label def tb2_a_c2 1 "男", modify
              label values birthyear_c2 tb1y_a_c2
              label values birthmonth_c2 tb1m_a_c2
              label values code_c3 code_a_c3
              label values gender_c3 tb2_a_c3
              label def tb2_a_c3 0 "女", modify
              label def tb2_a_c3 1 "男", modify
              label values birthyear_c3 tb1y_a_c3
              label values birthmonth_c3 tb1m_a_c3
              
              reshape long code_c gender_c birthyear_c birthmonth_c, i(pid) j(order)
              drop if missing(code_c)
              gsort fid -birthyear_c -birthmonth_c
              by fid: replace order=_n
              Res.:

              Code:
              . l, sepby(fid)
              
              +----------------------------------------------------------------------+
              | pid order fid code_c gender_c birthy~c birthm~c |
              |----------------------------------------------------------------------|
              1. | 1.100e+08 1 110001 203 男 . . |
              |----------------------------------------------------------------------|
              2. | 1.100e+08 1 110002 103 女 . . |
              3. | 1.100e+08 2 110002 103 女 . . |
              |----------------------------------------------------------------------|
              4. | 1.100e+08 1 110003 103 女 1997 1 |
              5. | 1.100e+08 2 110003 103 女 1997 1 |
              |----------------------------------------------------------------------|
              6. | 1.100e+08 1 110005 101 女 1991 1 |
              7. | 1.100e+08 2 110005 101 女 1991 1 |
              8. | 1.100e+08 3 110005 102 男 1962 10 |
              9. | 1.100e+08 4 110005 206 男 1959 11 |
              10. | 1.100e+08 5 110005 207 女 1958 . |
              |----------------------------------------------------------------------|
              11. | 1.100e+08 1 110006 103 女 1990 5 |
              12. | 1.100e+08 2 110006 103 女 1990 5 |
              |----------------------------------------------------------------------|
              13. | 1.100e+08 1 110007 103 男 1990 1 |
              14. | 1.100e+08 2 110007 103 男 1990 1 |
              15. | 1.100e+08 3 110007 101 女 1986 10 |
              16. | 1.100e+08 4 110007 101 女 1986 10 |
              |----------------------------------------------------------------------|
              17. | 1.100e+08 1 110009 107 男 . . |
              18. | 1.100e+08 2 110009 103 女 . . |
              19. | 1.100e+08 3 110009 102 男 . . |
              20. | 1.100e+08 4 110009 105 男 . . |
              21. | 1.100e+08 5 110009 105 男 . . |
              22. | 1.100e+08 6 110009 107 男 . . |
              |----------------------------------------------------------------------|
              23. | 1.100e+08 1 110010 203 女 1975 8 |
              |----------------------------------------------------------------------|
              24. | 1.100e+08 1 110011 105 男 2006 9 |
              25. | 1.100e+08 2 110011 105 男 2006 9 |
              26. | 1.100e+08 3 110011 104 女 2001 6 |
              27. | 1.100e+08 4 110011 104 女 2001 6 |
              28. | 1.100e+08 5 110011 103 女 1999 7 |
              29. | 1.100e+08 6 110011 103 女 1999 7 |
              |----------------------------------------------------------------------|
              30. | 1.100e+08 1 110013 103 男 1994 10 |
              31. | 1.100e+08 2 110013 103 男 1994 10 |
              |----------------------------------------------------------------------|
              32. | 1.100e+08 1 110015 107 男 1988 10 |
              33. | 1.100e+08 2 110015 107 男 1988 10 |
              34. | 1.100e+08 3 110015 106 女 1986 7 |
              35. | 1.100e+08 4 110015 106 女 1986 7 |
              36. | 1.100e+08 5 110015 104 男 1965 1 |
              37. | 1.100e+08 6 110015 103 男 1959 11 |
              |----------------------------------------------------------------------|
              38. | 1.100e+08 1 110019 107 男 2005 8 |
              39. | 1.100e+08 2 110019 107 男 2005 8 |
              40. | 1.100e+08 3 110019 106 女 2002 10 |
              41. | 1.100e+08 4 110019 106 女 2002 10 |
              42. | 1.100e+08 5 110019 105 女 1998 2 |
              43. | 1.100e+08 6 110019 105 女 1998 2 |
              44. | 1.100e+08 7 110019 203 男 1973 9 |
              45. | 1.100e+08 8 110019 203 男 1973 9 |
              46. | 1.100e+08 9 110019 104 女 1972 12 |
              47. | 1.100e+08 10 110019 104 女 1972 12 |
              |----------------------------------------------------------------------|
              48. | 1.100e+08 1 110020 104 男 1974 1 |
              49. | 1.100e+08 2 110020 103 男 1968 11 |
              +----------------------------------------------------------------------+
              Thank you so much for the solution! It is a really clever way to handle the problem.
              I have another small problem. Is it possible that after being ordered like above, I can change the style into the original wide layout with all information of the children after their parent but only with the right order, with a command of some kind? This is because I might also have to consider merge this with other related factors using pid.
              Thank you very much

              Comment

              Working...
              X