Announcement

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

  • Create output of explicit and implicit sample sizes

    I am working in a secure data facility. When I request results for disclosure review, the review officers want to see a table of explicit and implicit samples for my variables, all of which are categorical. For example, if I have a dataset with demographic characteristics of samples over multiple years, they want to see a table of cell counts that shows the number of observations in each combination of the demographic and year variables:

    Year_2020=1 Year_2020=0 Year_2019=1 Year_2019=0 Year_2018=1 Year_2018=0
    Age_group_1=1
    Age_group_1=0
    Age_group_2=1
    Age_group_2=0
    Age_group_3=1
    Age_group_3=0

    I am trying to find the most efficient way to produce this output. I do not know MATA, although this may be the best way to go. Built in commands like estout only works for regression output and xtable gets closer to what I want but given the number of tables I need to produce it is extremely inconvenient that it does not append tables into a single spreadsheet. I've tried to do my homework on this one but I could really use your help.

    Thank you!



  • #2
    Maybe use collapse, like this?
    Code:
    sysuse nlsw88, clear
    gen year = 1990 + runiformint(0,9)
    collapse (count) count=idcode, by(year age)
    Then export delimited or export excel the collapsed dataset if you like.
    David Radwin
    Senior Researcher, California Competes
    californiacompetes.org
    Pronouns: He/Him

    Comment

    Working...
    X