Created
May 27, 2015 02:15
-
-
Save jlisic/48e77231d0a5812539a7 to your computer and use it in GitHub Desktop.
Convert a sas binary file to a cvs without sas (but with R).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/Rscript | |
# get the usual argv | |
args <- commandArgs(trailingOnly == TRUE) | |
# get the input sas file name | |
inFile <- args[1] | |
# get the output csv file name | |
inFile <- args[1] | |
# if the file doesn't exist quit | |
if (!file.exists( inFile )) { | |
cat( sprintf("The file %s does not exist."), args[1] ) | |
quit(); | |
} | |
# load the library | |
library(sas7bdat) | |
# write the file out | |
write.csv(read.sas7bdat(inFile), outFile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment