Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading in NHIS survey data with read.SAScii #3

Closed
gbrlrz017 opened this issue Dec 16, 2015 · 2 comments
Closed

Reading in NHIS survey data with read.SAScii #3

gbrlrz017 opened this issue Dec 16, 2015 · 2 comments

Comments

@gbrlrz017
Copy link

Hi, I have a question about one of your examples in the documentation for read.SAScii.

Here's the verbatim example:

NHIS.11.samadult.SAS.read.in.instructions <-
"ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Program_Code/NHIS/2011/SAMADULT.sas"
NHIS.11.samadult.file.location <-
"ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/NHIS/2011/samadult.zip"

store the NHIS file as an R data frame!

NHIS.11.samadult.df <-
read.SAScii (
NHIS.11.samadult.file.location ,
NHIS.11.samadult.SAS.read.in.instructions ,
zipped = T, )

or store the NHIS SAS import instructions for use in a

read.fwf function call outside of the read.SAScii function

NHIS.11.samadult.sas <- parse.SAScii( NHIS.11.samadult.SAS.read.in.instructions )

save the data frame now for instantaneous loading later

save( NHIS.11.samadult.df , file = "NHIS.11.samadult.data.rda" )

I am trying to do the same with the 2010 version of the survey. However, with both this 2011 file and the 2010 file I get the error Error in toupper(SASinput) : invalid multibyte string 533 with the read.SAScii call. What can you make of it? Thanks!

@ajdamico
Copy link
Owner

hi, encoding. it is a waste of your time to re-do this on individual files. use the quick-start block at the top of

https://github.com/ajdamico/asdfree/blob/master/National%20Health%20Interview%20Survey/download%20all%20microdata.R#L8-L13

and everything will be imported automatically. thanks and keep in touch

@gbrlrz017
Copy link
Author

Hey, thanks for this! I have the data loaded and ready to work with these next few weeks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants