I tried all the solutions on the internet and failed. Hope you could help me with the case.
The url link of the data: http://scholar.rhsmith.umd.edu/sites/default/files/sbrown/files/pins_vdj_ann.sas7bdat.gz?m=146736684...
My code:
libname pinlib "E:\data\PIN_Stephen_Brown";
filename target "%sysfunc(pathname(pinlib))/test.sas7bdat";
filename fromzip ZIP "E:\data\PIN_Stephen_Brown\test.sas7bdat.gz";
data _null_;
infile fromzip
lrecl=256 recfm=F length=length eof=eof unbuf;
file target lrecl=256 recfm=N;
input;
put _infile_ $varying256. length;
return;
eof:
stop;
run;
It reports the error message as :
ERROR: The file "E:\data\PIN_Stephen_Brown\test.sas7bdat.gz" exists and is not a zip
file. The output file must be a zip file.
I appreciate your help very much if you could help me with this case.
Your comment is awaiting moderation.
I think you need to add GZIP to the filename statement that refers to the .gz file.
This code worked for me in SAS University Edition:
filename target "/folders/myfolders/GZIP/pins_vdj_ann.sas7bdat";
filename fromzip ZIP "/folders/myfolders/GZIP/pins_vdj_ann.sas7bdat.gz" GZIP;
data _null_;
infile fromzip lrecl=256 recfm=F length=length eof=eof unbuf;
file target lrecl=256 recfm=N;
input;
put _infile_ $varying256. length;
return;
eof:
stop;
run;
Chris Hemedinger provided the syntax to expand the data set in a comment on Reading and writing GZIP files with SAS.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.