error: unused arguments. importing sas7bdat file

I'm trying to import a SAS file using the haven package.

I've used this code, following the instructions from github:

#install haven package to read sas file

#read file from folder
marylandfund <- read_sas("maryland.sas7bdat", data_file, catalog_file=NULL, encoding=NULL, catalog_encoding=encoding, col_select=NULL, n_max=Inf, cols_only = "DEPRECATED")

and I got this error:

Error in read_sas("maryland.sas7bdat", data_file, catalog_file = NULL, :
unused arguments (data_file, col_select = NULL, n_max = Inf)

What does this mean? I'm new to R and statistical software so I can't quite figure it out on my own. Thank you!

Here is the help file description of read_sas()

read_sas(data_file, catalog_file = NULL, encoding = NULL,
  catalog_encoding = encoding, cols_only = NULL)

data_file is the name of the first parameter and I do not see any parameters named col_select or n_max. Try

marylandfund <- read_sas("maryland.sas7bdat", catalog_file=NULL, 
   encoding=NULL, catalog_encoding=encoding)


marylandfund <- read_sas("maryland.sas7bdat")

since you are using the default values for all of the parameters except data_file, which does not have a default. Placing "maryland.sas7bdat" first in the funciton call is the same as saying

marylandfund <- read_sas(data_file = "maryland.sas7bdat")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.