SAS unzip a single sas7bdat file
You need to copy the file out of the ZIP file and write to a physical file. You can use the FCOPY() function to do this. To force it to copy the file as BINARY you need to set RECFM=F and a LRECL value, 512 is a natural record size to use, when defining the filerefs.
So here is complete program to create a dataset, zip it, unzip it to a new name and compare the two versions.
* Get path of current WORK directory ;
%let work=%sysfunc(pathname(work));
* Make a new work dataset ;
data work.class; set sashelp.class; run;
** Make the ZIP file **;
ods package(zip) open nopf;
ods package(zip) add file="&work./class.sas7bdat";
ods package(zip) publish archive
properties(
archive_name= "sashelp.class.zip"
archive_path="&work."
)
;
ods package(zip) close;
* Create filerefs pointing to the source and target ;
filename zipin zip "&work/sashelp.class.zip" member="class.sas7bdat"
recfm=f lrecl=512
;
filename ssdout "&work/class2.sas7bdat" recfm=f lrecl=512;
* Use FCOPY() function to copy the file. ;
%let rc=%sysfunc(fcopy(zipin,ssdout));
* Check if it worked ;
proc compare data=class compare=class2; run;
If you cannot get FCOPY() to work try using the utility that Chris Hemedinger posted on his SAS Dummy blog. http://blogs.sas.com/content/sasdummy/2013/09/17/copy-file-macro/