Hi there,
I am looking at regressing the following specification:

where:

is the second (log-)difference.
i is exporter, j is importer, k is industry and t is year.
The tilde can be ignored the sake of this exercise. x is the unique export value for a exporter-importer-industry group and z is a measure for productivity specific for each exporter-industry-year group.
I was wondering how I can set the panel correctly, calculate this second difference in stata from the x variable, transform z appropriately as well and then run an OLS regression, the dataset has around 2 million observations so I would appreciate this being taken into account.
All help is much appreciated and please let me know if you require more information to address my issues.
Literature that derives this approach:
Arnaud Costinot, Dave Donaldson, Ivana Komunjer, What Goods Do Countries Trade? A Quantitative Exploration of Ricardo's Ideas, The Review of Economic Studies, Volume 79, Issue 2, April 2012, Pages 581–608, https://doi.org/10.1093/restud/rdr033
Nower, Michael, Is Ricardo Still Relevant? An Empirical Re-Examination of Ricardian Trade Theory (March 12, 2019). Available at SSRN: https://ssrn.com/abstract=3351220 or http://dx.doi.org/10.2139/ssrn.3351220
Visualisation of dataset:
I am looking at regressing the following specification:
where:
is the second (log-)difference.
i is exporter, j is importer, k is industry and t is year.
The tilde can be ignored the sake of this exercise. x is the unique export value for a exporter-importer-industry group and z is a measure for productivity specific for each exporter-industry-year group.
I was wondering how I can set the panel correctly, calculate this second difference in stata from the x variable, transform z appropriately as well and then run an OLS regression, the dataset has around 2 million observations so I would appreciate this being taken into account.
All help is much appreciated and please let me know if you require more information to address my issues.
Literature that derives this approach:
Arnaud Costinot, Dave Donaldson, Ivana Komunjer, What Goods Do Countries Trade? A Quantitative Exploration of Ricardo's Ideas, The Review of Economic Studies, Volume 79, Issue 2, April 2012, Pages 581–608, https://doi.org/10.1093/restud/rdr033
Nower, Michael, Is Ricardo Still Relevant? An Empirical Re-Examination of Ricardian Trade Theory (March 12, 2019). Available at SSRN: https://ssrn.com/abstract=3351220 or http://dx.doi.org/10.2139/ssrn.3351220
Visualisation of dataset: