Announcement

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

  • Counting number of individuals (by sex and age) that answer a question in a longitudinal study

    Hello,

    I have a dataset with information of abuse (variable name: abused) at work by age and sex (variables name "dvage" and "sex") for several waves.
    Can you please help me with the code to count the number of individuals that reported being abused (abuses==1) with less than 18 years old?
    I send an exampl eof the dataset below.
    Thank you very much in advance.


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long pidp byte sex int dvage float(wave abused)
     477155327 1 70 3 0
     408120371 1 47 4 0
     952728291 1 50 2 0
     952728967 1 75 4 0
     343381645 1 38 2 0
     816659611 1 74 2 0
    1565129487 1 54 4 0
     340718767 1 43 3 0
     952726251 1 61 1 0
    1088221691 1 48 2 0
     749690491 1 16 3 0
    1088228495 1 44 1 0
    1156394407 1 78 2 0
    1292607247 1 47 4 0
     612569167 1 60 2 0
     137317173 1 31 2 0
     952719447 1 59 1 0
     408946567 1 42 2 0
     413725726 1 17 2 0
     138998193 1 34 3 0
     963084050 1 38 3 0
     952731691 1 52 4 0
     952716055 1 71 4 0
    1564836407 1 39 4 0
     953429371 1 37 3 0
     818188929 1 84 4 0
    1371471650 1 58 4 1
     340312807 1 44 4 0
     639667845 1 63 1 0
     544046251 1 44 2 0
     693950209 1 84 2 0
     435491733 1 22 5 0
     340271327 1 56 5 0
     137936647 1 49 1 0
     952714695 1 18 2 0
     886142699 1 54 1 1
    1649673370 1 17 3 0
     544493685 1 69 1 0
     748222371 1 78 4 0
     428623049 1 62 2 0
     274429659 1 25 3 0
     273864571 1 46 4 1
     341991725 1 77 5 0
     816115607 1 75 5 0
     952709927 1 45 4 0
     844311805 1 44 2 0
     952709927 1 41 2 0
     613173687 1 58 2 0
    1633304255 1 26 1 0
     895818570 1 18 4 0
     680897611 1 60 3 0
    1088057131 1 73 4 0
    1021501447 1 38 3 0
    1496310091 1 56 2 0
     693677525 1 61 1 0
    1088896247 1 35 1 0
    1088410047 1 47 3 0
     952705847 1 37 3 0
     953328731 1 58 2 0
     895859250 1 25 4 0
     204301251 1 53 3 0
    1224193811 1 45 1 0
      95333965 1 56 1 0
     749812885 1 59 2 0
     952705171 1 30 2 0
      68378103 1 35 3 0
     952734411 1 49 5 0
     204626287 1 80 3 0
     682097809 1 42 1 0
    1225198171 1 54 3 0
     480297814 1 29 5 0
     612361767 1 68 3 1
     817125407 1 60 5 0
     408161175 1 26 2 0
     775770525 1 59 1 0
     836480937 1 20 4 0
     408627651 1 47 1 0
    1633122019 1 19 2 0
     952699735 1 30 5 0
     952735775 1 31 1 0
     545813571 1 43 1 0
     408877205 1 70 2 0
     776326085 1 62 2 0
     753712140 1 25 5 0
     952699731 1 49 2 0
     204240727 1 74 5 0
     885030899 1 19 3 0
     749312411 1 40 2 0
     748953367 1 57 2 0
     748555571 1 31 2 0
     952738487 1 58 2 0
     408750051 1 34 2 0
     748127847 1 32 5 1
    1020820091 1 29 4 0
     681106375 1 28 5 0
    1088422287 1 75 1 0
     952745287 1 35 2 0
    1582645690 1 28 5 0
     817293371 1 51 5 0
     816728291 1 73 2 0
    end
    label values sex c_sex
    label def c_sex 1 "male", modify
    label values dvage c_dvage




  • #2

    Code:
    tab dvage sex if dvage < 18 & abused == 1

    Comment


    • #3
      It worked ! Thank you very much

      Comment

      Working...
      X