Announcement

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

  • Constructing panel data set

    Hi

    I am trying to construct a panel dataset comprised of yearly observations of import values for different countries. Also included other basic variables like GDP, employment etc.

    All of the variables are measured at the country-year level, so there is one observation for country x in each year.

    However, the import values are refined to different product codes (HS codes) in order to differentiate between different products which have been imported. The issue with this is that there are thousands of different HS codes, so the data isn't balanced. It basically shows different import values for different HS codes, at country x in year y. All of the other variables (GDP, Employment etc.) are just repeated for each observation of HS code in that year.

    Is this an issue for an accurate regression? Would I need all of my variables at the country-year level and is it possible to collapse the import values to this level?

    Thanks for your help.

    James (total beginner if that isn't already obvious)


  • #2
    I'd probably organize the data so that each product is its own column, unless you want to estimate over all products HS Codes at the same time.

    You could use reghdfe and not worry about xtset. absorb(country HScode year).

    Or, you could create an id for each country/HS using egen idHS = group(country HScode) and then xtset.

    It all depends on exactly what you are trying to estimate.

    Comment


    • #3
      James:
      as an aside to George's helpful reply, please note:
      1) Stata handles both balanced and unbalanced panel datasetes (the latter are the rule, I'd say) without any problem;
      2) if you have time-invariant variables, be informed that the -fe- estimator will wipe them out (that is, Stata will not return any coefficient for those within-panlel constant pedictors).
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment

      Working...
      X