read_pnds {PNDSIBGE}R Documentation

Read PNDS microdata

Description

This function reads PNDS microdata.

Usage

read_pnds(microdata, input_txt, vars = NULL)

Arguments

microdata

A text file containing microdata from PNDS survey, available on official website: (select a microdata file, according to the appropriated year, microdata folder and then, inside, data) - ‘⁠https://ftp.ibge.gov.br/PNDS/⁠’.

input_txt

A text file, related to the microdata, containing the input script for SAS, available on official website: (select the dictionary and input zip file, according to the appropriated year, microdata folder and then, inside, documentation) - ‘⁠https://ftp.ibge.gov.br/PNDS/⁠’.

vars

Vector of variable names to be kept for analysis. Default is to keep all variables.

Value

A tibble with selected variables of the microdata, including the necessary survey design ones.

Note

For more information, visit the survey official website <https://www.ibge.gov.br/estatisticas/sociais/saude/9160-pesquisa-nacional-de-demografia-e-saude.html?=&t=o-que-e> and consult the other functions of this package, described below.

See Also

get_pnds for downloading, labeling, deflating and creating survey design object for PNDS microdata.
pnds_labeller for labeling categorical variables from PNDS microdata.
pnds_deflator for adding deflator variables to PNDS microdata.
pnds_design for creating PNDS survey design object.
pnds_example for getting the path of the PNDS toy example files.

Examples

input_path <- pnds_example(path="input_example.txt")
data_path <- pnds_example(path="exampledata.txt")
pnds.df <- read_pnds(microdata=data_path, input_txt=input_path, vars=c("J007","J009"))
pnds.df <- pnds.df[(pnds.df$M001 == "1" & !is.na(pnds.df$M001)),]
pnds.df <- pnds.df[,!(names(pnds.df) %in% c("V0029", "V00291", "V00292", "V00293"))]

[Package PNDSIBGE version 0.1.1 Index]