asdfree icon indicating copy to clipboard operation
asdfree copied to clipboard

Unable to download microdata for Pesquisa Nacional de Saude (PNS)

Open eliebmann opened this issue 6 years ago • 4 comments

Hello, I'm attempting to download the microdata for PNS for analysis but I am encountering the following error. This error occurs when I run

lodown( "pns" , output_dir = file.path( path.expand( "~" ) , "PNS" ) )

The error: [[1]] lodown("pns", pns_cat)

[[2]] withCallingHandlers(catalog <- load_fun(data_name = data_name, catalog, ...), error = function(e) { print(sessionInfo()) if (grepl("cannot allocate vector of size", e)) message(memory_note) else if (grepl("parameter must be specified", e)) message(parameter_note) else if (grepl("to install", e)) message(installation_note) else { message(unknown_error_note) print(sys.calls()) } })

[[3]] load_fun(data_name = data_name, catalog, ...)

[[4]] read_SAScii(dd, ds, na_values = ".")

[[5]] suppressWarnings(sasc <- SAScii::parse.SAScii(tf, beginline = beginline, lrecl = lrecl))

[[6]] withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))

[[7]] SAScii::parse.SAScii(tf, beginline = beginline, lrecl = lrecl)

[[8]] SAS.uncomment(SASinput, "/", "/")

[[9]] .handleSimpleError(function (e) { print(sessionInfo()) if (grepl("cannot allocate vector of size", e)) message(memory_note) else if (grepl("parameter must be specified", e)) message(parameter_note) else if (grepl("to install", e)) message(installation_note) else { message(unknown_error_note) print(sys.calls()) } }, "missing value where TRUE/FALSE needed", quote(if (max(asterisk_slash) < 0) SASinput[j] <- "" else SASinput[j] <- sub(substr(SASinput[j], 1, asterisk_slash[1] + 1), "", SASinput[j], fixed = T)))

[[10]] h(simpleError(msg, call))

My session info is: R version 3.3.1 (2016-06-21) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.11.6 (El Capitan)

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] lodown_0.1.0 devtools_1.13.6

loaded via a namespace (and not attached): [1] lattice_0.20-34 digest_0.6.13 withr_2.1.1 bitops_1.0-6 grid_3.3.1 R6_2.2.2
[7] git2r_0.16.0 survey_3.32-1 httr_1.3.1 curl_3.1 SAScii_1.0 Matrix_1.2-7.1 [13] splines_3.3.1 tools_3.3.1 RCurl_1.95-4.10 survival_2.40-1 memoise_1.1.0

Thank you,

Eddie

eliebmann avatar Jul 20 '18 17:07 eliebmann

Hello,

Thank you for your help on resolving this issue regarding access to the PNS microdata. I was hoping you might be able to give some indication as to when access to PNS might be restored.

Thank you, Eddie

eliebmann avatar Aug 21 '18 18:08 eliebmann

hi, you can submit a pull request if you'd like it fixed quickly. thanks!

ajdamico avatar Aug 21 '18 21:08 ajdamico

Hi @eliebmann

Warning: this is not a fix to the code; just a workaround to get PNS final survey design object!

I also had problems loading PNS dataset; what I did was download the dataset from IBGE site and put it on a local folder first, and then use a combination of scripts I've found to get the final survey design object. You can find the code at: https://gist.github.com/momenezes/50f6209802a9f5d6dba19677bbd909af Hope this help. Regards

momenezes avatar Nov 13 '18 13:11 momenezes

I am having the same problem with POF. Is there any fix to this problem? I have seen other problems with other brazilian data similar to this.

pedrogerber avatar Jan 11 '19 20:01 pedrogerber

hi! apologies for the long delay. i've made a couple of big updates to asdfree.com that hopefully make the website a bit better, but i've decided to stop maintaining the lodown package so probably won't fix the bug you've reported. the new asdfree does have pns data, but only for the most current year. thanks

ajdamico avatar Jan 09 '24 02:01 ajdamico