Announcement

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

  • Tabulating Oral Health NHANES examination data sets

    Hi,
    I would appreciate your help with the following question. NHANES oral health data include rows for each person that was examined and columns for each of the dental examination variables. Each dental variable represents the tooth number of the person, e.g., ohx08htc for tooth # 8, ohx07htc for tooth # 7. Each tooth variable has a code, 1 for Primary tooth present, 2 for Permanent, present, 4 for Tooth not present.

    I would like to tabulate the number of persons examined that had a code of 4 (tooth not present) in all examined teeth (all together 32). Please see below for a description of the data. Link to data sets: https://wwwn.cdc.gov/Nchs/Nhanes/2005-2006/OHX_D.XPT

    Kind Regards,
    Victor
    seqn ohx08htc ohx07htc ohx06htc
    31128 2 2 1
    31129 2 2 2
    31130 2 2 2
    31131 2 2 2
    31132 2 2 2
    31133 2 2 2
    Variable Label Type Format
    ohx08htc Tooth # 8 double %10.0g
    ohx07htc Tooth # 7 double %10.0g
    ohx06htc Tooth # 6 double %10.0g
    seqn Respondent sequence number double %10.0g
    Variable Name:
    OHX08HTC
    SAS Label:
    Tooth count: #8
    English Text:
    Tooth Count: Upper right central incisor (CI)
    Target:
    Both males and females 5 YEARS - 150 YEARS
    Code or Value Value Description Count Cumulative
    1 Primary tooth (deciduous) present 322 322
    2 Permanent tooth present 6485 6807
    4 Tooth not present 865 7672
    5 Permanent dental root fragment present 10 7682
    9 Could not assess 5 7687
    . Missing 618 8305

  • #2
    I would like to tabulate the number of persons examined that had a code of 4 (tooth not present) in all examined teeth (all together 32).
    Does this mean that you want a single number that tells you the number of people who had a code of 4 in any of the 32 teeth?
    Code:
    egen byte has_some_tooth_missing = anymatch(ohx*htc), values(4)
    count if has_some_tooth_missing
    Or does it mean you want 32 numbers, one for each tooth, telling you the number of people who had a code of 4 in that tooth?
    Code:
    forvalues i = 1/32 {
        local ii: display %02.0f `i'
        quietly count if ohx`ii'htc == 4
        display "`r(N)' people are missing tooth `i'"
    }
    In the future, when showing data examples, please use the -dataex- command to do so. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    Comment

    Working...
    X