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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.