each year. The data covers around 270,000 trainees per year.

To compute GFC-induced foreign demand shocks for firms, we rely on customs data covering the universe of firm-level export and import transactions collected by the Brazilian Secretariat of Foreign Trade (SECEX). We merge the customs data to the worker panel database based on a common unique firm identifier. We derive a firm panel database from the starting RAIS worker panel database where, for each firm, labor market outcome variables are constructed by aggregating across all its workers in a given year. This firm panel database includes all firms that export at least once during the 2004-2017 period.<sup>12</sup> In addition, we use the Annual Industrial Survey (Pesquisa Industrial Anual (PIA)) collected by the Brazilian Institute of Geography and Statistics (IBGE) for the 2003-2014 period to augment the set of firm-level outcomes considered. This is a longitudinal manufacturing census database with information on firm financial characteristics that we use to construct measures of productivity, profits and non-labor inputs.<sup>13</sup> We link this firm panel database with the RAIS firm panel database and the customs data based on a common unique firm Finally, we supplement the worker panel database with data from the Brazilian Census in 2000 to measure characteristics of the worker’s municipality. We construct a measure of informality as the ratio between the sum of informal salaried and self-employed workers and the total number of workers (formal, informal and self-employed) in a municipality. We follow Dix-Carneiro & Kovak (2019) in defining informal workers as those without a signed work card based on information in RAIS.

Table 1 shows the sample sizes as well summary statistics for the main worker variables (Panel A) and firm variables (Panel B). Our worker analysis relies on more than 342,000 workers (about 3 million worker-year observations). On average workers are employed 10 months per year. This lower than full-year (12 months) work average can be rationalized by the fact that the sample includes 19% of observations with zero months worked (added to the worker panel database as described earlier). The average monthly real wages are 2,725 in 2010 Reais (about 831 USD at the 2015 exchange rate).<sup>14</sup> Our firm analysis relies on 15 thousand firms (about 119 thousand firm-year observations).<sup>15</sup>

> 12For these firms the panel includes all years of data (even years when the firm is not exporting).

> 13The PIA survey is mandatory for firms with either more than 30 employees or above a revenue cutoff and also for an annual random sample of smaller firms, as described by Alvarez et al. (2018). Estimation based on the PIA firm panel database was conducted in a secure room at the IBGE premises in Rio de Janeiro.

> 14Summary statistics on worker controls in Appendix Table A1 show the workers in the sample average 33 years of age, a quarter are female and only 16% have higher education. Workers were employed in the formal sector about 67% of the time before the GFC.

> 15Appendix Table A1 shows almost 60% of firms are importers, a finding that is not surprising as the sample covers firms that export and the phenomenon of importing-to-export is common. Firms experience on average substantial annual growth in employment prior to the GFC of 11%, but annual growth in total wages is only 2% higher, resulting in moderate growth in average wages that is smaller than inflation rates.

9