Announcement

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

  • Grouping Firm Level Data and Its Branches

    Dear Statalisters,

    I am working with a dataset at the firm level. The datasets for firms and branches are separate. In the branch dataset, firm IDs are repeated as branches are associated with firms, and the branch IDs are present as a separate variable on the same row.

    The dataset includes IDs for firms and their associated branches. Each firm has a unique ID, and each branch also has a unique ID. How can I define firms as a group and branches as subgroup variables related to firms when examining firm and branch data in Stata?

    Unfortunately, I cannot share a dataex example with you since I am allowed to work with data on computers that are not connected to the internet. I appreciate your assistance in advance.

    Thank you very much.

  • #2
    I'm not sure if I understand your question correctly. If branch IDs are not distinct— for example, if firm X has branch ID #2 and firm Y also has branch ID #2—you can create unique branch IDs using the -group()- function of egen. See

    Code:
    help egen

    Code:
    egen wanted= group(firm_ID branch_ID), label
    tab wanted
    Unfortunately, I cannot share a dataex example with you since I am allowed to work with data on computers that are not connected to the internet.
    Also note that FAQ Advice #12 addresses the issue of confidential data.
    Last edited by Andrew Musau; 17 Jan 2024, 03:43.

    Comment

    Working...
    X