Announcement

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

  • survey data summary

    hi,
    I have the below data; I am new in Stata so struggling to produce the right summary.
    hid fid cluster line1 sex1 age1 line2 sex2 age2 .... line10 sex10 age10
    1 1 1 1 m 5 2 m 12 ..... 10 f 65
    1 2 1 1 f 20 2 m 14 10 m 80
    2 1 2 1 m 8 2 m 12
    3 1 3 1 f 54 2 f 3 ..... 15 60
    4 1 2 1 m 22
    how I calculate the below summary: (There are 10 variables for each household and in some survey just 5 members' data are available while few all 10)

    - Counting all line # for individual households: *For household 1 there is 20 member (10 in the first family + 10 in the second family) while for household 4 is just 1;
    - counting all line# for individual households cluster vise: CLUSTER 3 only 10 people while in Cluster 4 there is just one person living
    - Counting all males/females living in individual households as well as cluster vise.
    - total populations in survey cluster vise and # of male & female row and column total.



  • #2
    Welcome to Statalist,

    Very hard to help without seeing the data and its format. Please follow the advice in the FAQ by providing some sample data. Try this code:

    Code:
    dataex hid fid cluster line1 sex1 age1 line2 sex2 age2 line3 sex3 age3 line10 sex10 age10, count(100)
    And then paste the sample data here. Users here can then input those into Stata and suggest working codes for you.

    Comment


    • #3
      hid cluster fid line#1 Sex1 age1 line#2 Sex2 age2 line#3 Sex3 age3 line#4 Sex4 age4
      88-88001-001-01 88 1 1 1 60 2 2 56 3 1 24 4 2 22
      88-88001-001-02 88 2 1 1 37 2 2 28 3 2 2
      89-8902-4002-01 89 1 1 1 31 2 2 30 3 2 5 4 2 1
      88-88001-001-04 88 4 1 1 28 2 2 21 3 2 1
      89-89024-004-01 89 1 1 1 27 2 2 28 3 2 7 4 2 5
      89-89-89024-003 89 1 1 1 52 2 2 49 3 1 28 4 2 26
      89-89024-003-01 89 1 1 1 52 2 2 49 3 1 28 4 1 26
      90-90001-001-0 90 3 1 1 50 2 2 48 3 2 24 4 2 22

      Comment


      • #4
        sex: 1, male 2, female
        Line # is the serial number of the family
        cluster is 88, 89, 90
        fid: if more than one family lives in the household they will assign family like 1, 2, 3....

        Comment


        • #5
          Not this form. Currently, the data example in #3 will not even work because it'd trigger missing period in those cases with missing. Also "#" is not allowed in variable name. If anyone would like to help they they will have to spend extra time to make the data usable.

          After you've run the dataex code, you should receive an output wrapped with "CODE" and "\CODE" in Stata, please paste that whole chunk from "CODE" to "\CODE".

          Comment


          • #6
            input str10 hid byte fid str3 cluster byte(line1 sex1 age1 line2 sex2 age2 line3 sex3 age3)
            "c13-001-01" 1 "c13" 1 1 60 2 2 56 3 1 24
            "c13-001-02" 2 "c13" 1 1 37 2 2 28 3 2 2
            "c16-002-01" 1 "c16" 1 1 31 2 2 30 3 2 5
            "c13-001-03" 4 "c13" 1 1 28 2 2 21 3 2 1
            "c16-004-01" 1 "c16" 1 1 27 2 2 28 3 2 7
            "c16-003-01" 1 "c16" 1 1 52 2 2 49 3 1 28
            "c16-003-01" 1 "c16" 1 1 52 2 2 49 3 1 28
            "c13-001-03" 3 "c13" 1 1 50 2 2 48 3 2 24
            "c16-007-01" 1 "c16" 1 1 23 2 2 20 3 2 1
            "c16-006-01" 1 "c16" 1 1 60 2 2 54 3 1 16
            "c16-008-01" 1 "c16" 1 1 55 2 2 23 3 2 6
            "c16-004-01" 1 "c16" 1 1 23 2 2 40 3 1 25
            "c16-009-01" 1 "c16" 1 1 37 2 2 34 . . .
            "c16-001-01" 1 "c16" 1 1 40 2 2 30 . . .
            "c16-010-01" 1 "c16" 1 1 29 2 2 25 3 2 4
            "c16-007-01" 2 "c16" 1 1 33 2 2 28 3 2 12
            "c16-009-02" 1 "c16" 1 1 20 2 2 25 3 2 3
            "c16-005-01" 1 "c16" 1 1 37 2 2 34 . . .
            "c16-001-01" 1 "c16" 1 1 50 2 2 45 3 1 7
            "c21-002-01" 2 "c21" 1 1 52 2 2 48 3 2 20
            end
            here is the output after pasting it to dataex as advised
            please keep in mind that, i am a NEW/beginner Stata user. Thanks in advance.

            Comment

            Working...
            X