Announcement

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

  • How to create a table with multiple variables

    Hello,

    I would like to create 3 tables twith the number of indivduals (in all waves 1 to 5) that reported abused==1 in the follwoing case:
    Table 1:
    - rows defined by :
    - total individuals, only male and only female
    - total indivoiduals, male and female when sinmastatus_ab = 1
    - total indivoiduals, male and female when partnsersh_ab = 1
    - ​​​​​​total indivoiduals, male and female when sepstatus_ab = 1
    - total ndivoiduals, male and female when widowed_ab==1
    - columns defined by:
    - the total number of individuals that reported abused==1 in the above 3 cases separated by "group_age" and then by "country"
    Table 2: the above information but only for individuals that reported fulltime_ab==1
    Table 3: the initial information but only for individuals that reported parttime_ab==1

    I now how to perform the analysis separately but it is time consuming since the dataset in very large.
    I attached a picture of the table (upper table) with the outcome that I need to achieve with the required commands.
    Thank you very much in advance.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long pidp byte sex float wave byte country float(group_age fulltime_ab parttime_ab sinmastatus_ab partnersh_ab sepstatus_ab widowed_ab abused)
     410355535 1 1 1 1 0 0 0 0 0 0 0
     816639891 2 2 1 1 0 0 0 0 0 0 0
     340005455 2 2 1 1 0 0 0 0 0 0 0
     952701767 2 2 1 1 0 0 0 0 0 0 0
    1632297171 1 3 1 1 0 0 0 0 0 0 0
    1170321010 2 5 1 1 0 0 0 0 0 0 0
    1224910539 1 3 1 1 0 0 0 0 0 0 0
    1428712663 1 2 1 1 0 0 0 0 0 0 0
     748128535 1 2 1 1 0 0 0 0 0 0 0
     476830975 1 2 1 1 0 0 0 0 0 0 0
    1295801964 2 1 1 1 0 0 0 0 0 0 0
     408142815 2 2 1 1 0 0 0 0 0 0 0
     272378783 2 5 1 1 0 0 0 0 0 0 0
     340607259 1 1 1 1 0 0 0 0 0 0 0
     544602499 1 5 1 1 0 0 0 0 0 0 0
     544374007 2 2 1 1 0 0 0 0 0 0 0
     408541299 1 2 1 1 0 0 0 0 0 0 0
    1224163895 2 1 1 1 0 0 0 0 0 0 0
     818917889 1 2 1 1 0 0 0 0 0 0 0
     885927135 1 2 1 1 0 0 0 0 0 0 0
     204243459 2 2 1 1 0 0 0 0 0 0 0
     751793049 2 2 1 1 0 0 0 0 0 0 0
     340947259 1 1 1 1 0 0 0 0 0 0 0
     884224415 2 1 1 1 0 0 0 0 0 0 0
     612221695 1 1 1 1 0 0 0 0 0 0 0
      69426667 1 5 1 1 0 0 0 0 0 0 0
    1089646295 2 4 1 1 0 0 0 0 0 0 0
    1293532743 2 5 1 1 0 0 0 0 0 0 0
     205203619 1 4 1 1 0 0 0 0 0 0 0
     551289766 1 2 1 1 0 0 0 0 0 0 0
    1428870415 2 2 1 1 0 0 0 0 0 0 0
    1031464890 1 3 1 1 0 0 0 0 0 0 0
     952262495 2 2 1 1 0 0 0 0 0 0 0
     477664675 2 2 1 1 0 0 0 0 0 0 0
     479990253 1 5 1 1 0 0 0 0 0 0 0
    1632070055 2 4 1 1 0 0 0 0 0 0 0
    1428268627 2 3 1 1 0 0 0 0 0 0 0
     952420247 1 3 1 1 0 0 0 0 0 0 0
    1021668075 1 3 1 1 0 0 0 0 0 0 0
    1292768415 2 4 1 1 0 0 0 0 0 0 0
    1088238244 1 1 1 1 0 0 0 0 0 0 0
     884805815 2 5 1 1 0 0 1 0 0 0 1
    1224268619 2 3 1 1 0 0 0 0 0 0 0
    1088206055 1 1 1 1 0 0 0 0 0 0 0
    1020267939 1 1 1 1 0 0 0 0 0 0 0
     205156693 1 1 1 1 0 0 0 0 0 0 0
     612422979 1 3 1 1 0 0 0 0 0 0 0
     680886739 2 5 1 1 0 0 0 0 0 0 0
    1089740139 2 2 1 1 0 0 0 0 0 0 0
     614503775 2 1 1 1 0 0 0 0 0 0 0
      68361767 2 1 1 1 0 0 0 0 0 0 0
    1511755770 1 4 1 1 0 0 0 0 0 0 0
      68548095 1 4 1 1 0 0 0 0 0 0 0
     681143775 1 2 1 1 0 0 0 0 0 0 0
    1020214215 2 1 1 1 0 0 0 0 0 0 0
     612006133 1 3 1 1 0 0 0 0 0 0 0
     340358383 2 5 1 1 0 0 0 0 0 0 0
     682065173 2 4 1 1 0 0 0 0 0 0 0
     818114137 1 3 1 1 0 0 0 0 0 0 0
     204268615 2 2 1 1 0 0 0 0 0 0 0
    1634643855 2 3 1 1 0 0 0 0 0 0 0
     408626295 2 3 1 1 0 0 0 0 0 0 0
    1514115290 2 3 1 1 0 0 0 0 0 0 0
     886843162 1 1 1 1 0 0 0 0 0 0 0
     340992135 1 5 1 1 0 0 0 0 0 0 0
     890883802 2 2 1 1 0 0 0 0 0 0 0
     205958415 2 3 1 1 0 0 0 0 0 0 0
     613518459 2 3 1 1 0 0 0 0 0 0 0
     408425017 1 3 1 1 0 0 0 0 0 0 0
     341420533 2 1 1 1 0 0 0 0 0 0 0
     341665339 2 2 1 1 0 0 0 0 0 0 0
    1496682739 2 1 1 1 0 0 0 0 0 0 0
     342001935 2 1 1 1 0 0 0 0 0 0 0
     689506684 1 2 1 1 0 0 0 0 0 0 0
     817737413 1 2 1 1 0 0 0 0 0 0 0
     340258419 1 4 1 1 0 0 0 0 0 0 0
     136556931 2 2 1 1 0 0 0 0 0 0 0
     205145815 2 3 1 1 0 0 0 0 0 0 0
     272665731 2 1 1 1 0 0 0 0 0 0 0
      68773855 2 2 1 1 0 0 0 0 0 0 0
     205217972 2 3 1 1 0 0 0 0 0 0 0
    1225884967 1 2 1 1 0 0 0 0 0 0 0
     544180211 2 4 1 1 0 0 0 0 0 0 0
    1428725579 1 2 1 1 0 0 0 0 0 0 0
    1564510015 1 2 1 1 0 0 0 0 0 0 0
    1020542655 1 4 1 1 0 0 0 0 0 0 0
    1634214775 2 3 1 1 0 0 0 0 0 0 0
    1224992135 2 2 1 1 0 0 0 0 0 0 0
    1020449495 2 1 1 1 0 0 0 0 0 0 0
     205862531 1 3 1 1 0 0 0 0 0 0 0
    1225889735 1 2 1 1 0 0 0 0 0 0 0
     682232453 1 3 1 1 0 0 0 0 0 0 0
     204191775 1 1 1 1 0 0 0 0 0 0 0
     343307533 1 2 1 1 0 0 0 0 0 0 0
     958290448 2 2 1 1 0 0 0 0 0 0 0
    1021560607 2 1 1 1 0 0 0 0 0 0 0
     885394019 1 2 1 1 0 0 0 0 0 0 0
     340297855 1 5 1 1 0 0 0 0 0 0 0
    1428187699 2 2 1 1 0 0 0 0 0 0 0
    1496868375 1 3 1 1 0 0 0 0 0 0 0
    end
    label values sex c_sex
    label def c_sex 1 "male", modify
    label def c_sex 2 "female", modify
    label values country c_country
    label def c_country 1 "England", modify
    label values group_age group_age
    label def group_age 1 "25 >= age > 15", modify
    label values fulltime_ab fulltime_ab
    label def fulltime_ab 0 "full-time employee not abused at work", modify
    label values parttime_ab parttime_ab
    label def parttime_ab 0 "part-time employee not abuse at work", modify
    label values sinmastatus_ab sinmastatus_ab
    label def sinmastatus_ab 0 "single marital status: not abused at work", modify
    label def sinmastatus_ab 1 "single marital status: abused at work", modify
    label values partnersh_ab partnersh_ab
    label def partnersh_ab 0 " in partnership: not abused at work", modify
    label values sepstatus_ab sepstatus_ab
    label def sepstatus_ab 0 "separated status: not abused at work", modify
    label values widowed_ab widowed_ab
    label def widowed_ab 0 "widowed: not abused at work", modify
    label values abused abc
    label def abc 0 "not abused at work", modify
    label def abc 1 "abused at work", modify
    Attached Files
Working...
X