read_pns: Read PNS microdata

View source: R/read_pns.R

read_pnsR Documentation

Read PNS microdata

Description

This function reads PNS microdata.

Usage

read_pns(microdata, input_txt, vars = NULL)

Arguments

microdata

A text file containing microdata from PNS 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/PNS/.

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/PNS/.

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-saude.html?=&t=o-que-e> and consult the other functions of this package, described below.

See Also

get_pns for downloading, labeling, deflating and creating survey design object for PNS microdata.
pns_labeller for labeling categorical variables from PNS microdata.
pns_deflator for adding deflator variables to PNS microdata.
pns_design for creating PNS survey design object.
pns_example for getting the path of the PNS toy example files.

Examples

input_path <- pns_example(path="input_example.txt")
data_path <- pns_example(path="exampledata.txt")
pns.df <- read_pns(microdata=data_path, input_txt=input_path, vars=c("J007","J009"))

PNSIBGE documentation built on Nov. 19, 2023, 1:08 a.m.