BookmarkSubscribeRSS Feed
zilong567
Calcite | Level 5

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.

2 REPLIES 2
SuzanneDorinski
Lapis Lazuli | Level 10

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.

Reeza
Super User
What version of SAS do you have? Support for GZ was only added recently, before that it supported WinZip only.

The link in @SuzanneDorinkski has the details.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 8248 views
  • 0 likes
  • 3 in conversation