analyze the pesquisa nacional de saude (pns) with r

[This article was first published on asdfree, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

starting in 1988, the brazilian institute of geography and statistics (ibge) quinquennially included a health supplement questionnaire alongside their annual pesquisa nacional de domicilios (pnad) to monitor public health and inform the ongoing debate both in brasilia and within each municipalidade.  that setup worked for a while, but the survey experts at ibge knew that policymakers could only learn so much from a sidekick questionnaire.  rather than continue that second banana setup, the health survey methodologists in rio de janeiro fashioned a new instrument to work alongside the integrated system of household surveys – chief among them, the continuous pnad – in order to replace, maintain, expand that old medical module.

the pesquisa nacional de saude (pns) monitors the performance of the brazilian healthcare system, with disease surveillance, risk behavior assessment, and a familiar battery of access-to-care questions that health services researchers might be seeing for the first time in portuguese.  this is brazil’s healthcare survey.  now that ibge has published the first collection, you (yes you) have the publicly-available person-level data to begin a serious study of brazilian medicine.  individuals responding to the pns offer up information like tobacco use, sedentary lifestyles, diabetes diagnosis.  if you follow our examples, you’ll be able to draw statistically-valid conclusions along linhas like age, race, education, and yes even estado.  thanks to djalma pessoa for teaching both you and me how to work with this primary (and ultra-current) source to understand most anything about the health status of the brazilian people.  this new repository contains three scripts:

download and import.R
  • download the latest zipped household- and person-level microdata ascii files
  • import each table directly into a data.frame object with sascii
  • post-stratify each survey design according to the official documentation, so you don’t have to

analysis examples.R
  • run the well-documented block of code reviewing most of the syntax configurations you’ll need for basically any breakout that you might imagine or desire

replicate tableas.R
  • prove that r will precisely match the ibge-produced statistics and standard errors because we are thorough like that

click here to view these three scripts

for more detail about the pesquisa nacional de saude (pns), visit ibge’s pns landing page and go from there.  it’s got everything that we do not.  this is a brand new survey for you to fall in love with.

confidential to sas, spss, stata, and sudaan users: purchasing statistical software may be hazardous to your wallet.

To leave a comment for the author, please follow the link and comment on their blog: asdfree. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)