J.ZHONG
J.ZHONG

Reputation: 51

use read_sas to read specific file under a zipped file in R

I have a zipped sas file and there are couple sas files inside that. Just want to know if there is a chance that I can use read_sas function to read specific file under that zipped file? Couldn't find anything online about that.

Checked the ?read_sas nothing mentioned about that.

code I used :

# zipped file name: example.zip
# files inside example.zip file are file1.sas7bdat, file2.sas7bdat and targetfilename.sas7bdat
file <- read_sas(example.zip, 'targetfilename.sas7bdat')

outcome: read_sas only read the first file inside that zipped file.

Sorted solution:

 read_sas(unz("examp;e.zip", "'targetfilename.sas7bdat'"))

Upvotes: 0

Views: 377

Answers (1)

J.ZHONG
J.ZHONG

Reputation: 51

solved:

   read_sas(unz("examp;e.zip", "'targetfilename.sas7bdat'"))

Upvotes: 1

Related Questions