Announcement

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

  • How to combine several dtable into a single one?

    Hello everyone, I am new to using Stata, so please bear with me if my question seems naive. Currently, I am attempting to utilize the dtable function to generate descriptive statistics. However, I am encountering difficulties when it comes to combine multiple descriptive statistics tables into a single table. I have categorized my observations into three groups: Science, STEM, and Social Science & Arts. Each group has a corresponding dummy variable. The issue is that these categories overlap; an observation labeled as 'Science' may also fall under 'STEM' or 'Social Science.' Consequently, I cannot simply combine them into a single variable and employ the "by (field) " command.

    My code is very simple

    Code:
    dtable yrcurrinst yrphdaward acarank i.academicrank i.gender, by(science, nototals) 
    dtable yrcurrinst yrphdaward acarank i.academicrank i.gender, by(art_social_science, nototals) 
    dtable yrcurrinst yrphdaward acarank i.academicrank i.gender, by(stem, nototals) 
    dtable yrcurrinst yrphdaward acarank i.academicrank i.gender
    I want my first column to be total, the second one to be science, the third one to be STEM and the fourth one to be Social Science and Arts.

    I am aware that manually copying and pasting the data into a spreadsheet is an option, but I am hoping to find a more efficient approach using Stata code. If anyone has any insights on how to accomplish this, I would greatly appreciate your assistance.
Working...
X