Announcement

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

  • how to generate Industry_FE*Year_FE variable in stata

    Dear members

    I am using the staggered DID in my data analysis and would like to control for industry*Year fixed effects together in my model. How can I create this variable? I also would like to identify firm-year observations that do not have financial data in my dataset so that I can drop them before doing my analysis.

    Thanks for your kind help.

    here is an example of my dataset:
    input str44 Country int Year float SIC_2digit byte Civil_lib float Firm_id
    "Argentina" 2014 . 2 9
    "Australia" 2011 10 1 183
    "Austria" 2011 43 1 37
    "Bangladesh" 2019 32 5 196
    "Belgium" 2006 38 1 203
    "Brazil" 2013 . 2 448
    "Canada" 2019 13 1 687
    "Sri Lanka" 2018 21 4 3422
    "Chile" 2006 49 1 792
    "China" 2016 12 6 875
    "Colombia" 2014 32 4 1105
    "Croatia" 2019 29 2 1930
    "Denmark" 2020 . 1 1235
    "Finland" 2012 . 1 1342
    "France" 2018 36 2 1448
    "Germany" 2005 28 1 1208
    "Hungary" 2009 48 1 1931
    "Iceland" 2019 38 1 2189
    "India" 2018 15 3 2187
    "Indonesia" 2016 45 4 1970
    "Ireland" 2015 50 1 1990
    "Israel" 2013 48 2 2012
    "Italy" 2017 . 1 2223
    "Japan" 2020 48 1 2561
    "Jordan" 2019 14 5 2282
    "South Korea" 2007 35 2 3046
    "Kuwait" 2019 48 5 3081
    "Lithuania" 2018 48 1 3428
    "Malaysia" 2018 44 4 3554
    "Mexico" 2016 15 3 3482
    "Morocco" 2013 48 4 3451
    "Netherlands" 2013 35 1 3623
    "New Zealand" 2018 12 1 3692
    "Norway" 2013 . 1 3660
    "Pakistan" 2015 13 5 3784
    "Peru" 2009 49 3 3722
    "Philippines" 2016 49 3 3749
    "Poland" 2008 49 1 3803
    "Portugal" 2019 24 1 3814
    "Saudi Arabia" 2019 28 7 3865

  • #2
    [I] would like to control for industry*Year fixed effects together in my model
    Code:
    egen indyear= group(industry year), label
    Then include these as

    Code:
    i.indyear
    or absorb this variable, depending on what your estimation command allows you to do.

    I also would like to identify firm-year observations that do not have financial data in my dataset so that I can drop them before doing my analysis.
    You do not need to do that. The command will automatically exclude such observations as (most) estimation commands implement listwise deletion of missing values. But if you want to do that to obtain summary statistics for the sample, start by running the command and then generate a variable that identifies observations in the sample.

    Code:
    command outcome regressors  
    gen sample= e(sample)
    summarize outcome regressors if sample
    Last edited by Andrew Musau; 10 Sep 2023, 23:29.

    Comment


    • #3
      Thanks, Andrew for your help.

      Comment

      Working...
      X