analyze the pesquisa mensal de emprego (pme) with r

whether or not you hit the snooze button, once every month your morning radio station probably announces the latest employment statistics for the nation.  in the united states, those headlines come from the bureau of labor statistics' current population survey.  meanwhile down in rio de janeiro, the brazilian institute of geography and statistics (ibge) releases a staggeringly similar pesquisa mensal de emprego.  simply translated: monthly employment survey.  my friend djalma pessoa at ibge co-authored this post and the dutifully-commented code, so let me loosely paraphrase beyonce and recommend, "if you like it then you shoulda [sent him a nice thank-you note]..wuh-uh-oh.."

the primary tool to assess the brazilian labor force, this household-level survey only covers the metropolitan areas of the six largest cities (about a quarter of the nationwide population).  though there's plenty of information about the income and circumstances of active workers, this data set contains plenty of detail about what the unemployed are trying in order to get a job themselves (employment agencies, entrance exams).  and, although this sample gets conducted as a panel, the individuals surveyed over multiple months cannot be connected across public-use files.  so there you have it.  when you're ready to fire up your formal research of the brazilian labor market, well, this new github repository contains four scripts:

download all microdata.R
  • download each monthly zipped file, plus documentation
  • import each individual microdata table directly into r, short and sweet
  • store quick-to-load copies of each microdata table for easy access later

analysis examples.R
  • load a single month of data into working memory
  • construct the complex sample survey object, post-stratifying according to ibge specifications
  • run example analyses that calculate perfect means, medians, quantiles, totals, even ratios

unemployment rate.R


click here to view these four scripts

for more detail about the pesquisa mensal de emprego, visit:


starting in march of 2014, the pme will be re-weighted in order to hit population projections from their 2013 revision and maintain trendability over the past decade. ibge will also begin publishing weight variables that contain the same number of decimal places as are used internally to compute the published tables.  for reproducibility's sake: manero!

although undergoing a few revisions after its preliminary launch in the early eighties, the file structure of the pme has not changed since 2002, the first month of downloadable microdata.  therefore, the code that worked on a mid-2002 microdata month should also work on mid-2012 month.  and if you're a serious pme user, you likely also seriously speak portuguese.  in that case, you might as well get started on the portuguese-language version of their homepage.

confidential to sas, spss, stata, sudaan users: leave those bananas for the monkeys.  to r is human. :D