BookmarkSubscribeRSS Feed
LineMoon
Lapis Lazuli | Level 10

Hello,

 

I have a big file .zip :  Y:/M/N/BIG_File.zip, the size of big_file.zip is 6 GB.

So I want to unzip the file big_file.zip  into a new folder : BIG_FILE

 rep --> Y:/M/N/rep

 

I use this sas code

 

%let dir=Y:/M/N;

X cd &dir;

filename pipe "unzip  BIG_FILE -d  REP/BIG_FILE";

 

So I get this message :

unzip : cannot find  BIG_FILE.zip, BIG_FILE.ZIP, BIG_FILE

 

So If i use the last code for a small file, the unzip works well.

So I need to unzip a big directory with more than 6 GB.

Thank you

 

 

 

 

 

 

 

17 REPLIES 17
Astounding
PROC Star

Could it just be a spelling issue?  Unix treats upper case as different than lower case.

LineMoon
Lapis Lazuli | Level 10

Thank you for your intereste.

No, it is not a matter of spelling,lowwer case, or upper case.

I have tested that.

the unzip works well for the small file, but not for a big file

 

 

Reeza
Super User

Post your log a screenshot of your file in the path please.

 

Also, does it work if you do it via command line? If not, then it's not a SAS issue, it's an issue with the zip utility. 

LineMoon
Lapis Lazuli | Level 10

Thank you for your answer.

I will check that

Tom
Super User Tom
Super User

What version of ZIP does your system have?  You might not have support for large files.  You need at least ZIP 3.0.  Or you could try 7ZIP instead.

LineMoon
Lapis Lazuli | Level 10

@Tom: Thank your message.

I think gzip. But as I hear from some people, sas used his zip.

So how can I identify the zip utilities on unix  and version?

Reeza
Super User

@LineMoon The method you're using to unzip is not a SAS method or procedure. It's using SAS to pass Unix Commands to your unix system. So whatever is on your box is what you have available. 

 

 

It's another way of saying:

 

X "unzip blabhlbhafile";

 

If you want to know the utilities on unix ask your administrator. 

Kurt_Bremser
Super User

SAS has a built-in engine to unzip input files on the fly, which you can use in filename and infile statements. Things that you call externally, OTOH, depend on the commands supplied by the operating system.

 

By the way, you used

%let dir=Y:/M/N;

which looks like a Windows path, as UNIX does not use (and does not allow) drive letters.

LineMoon
Lapis Lazuli | Level 10

No , I want to say this

%let dir=Y/M/N;

No , it is not a windows path, it is a unix path.

in my code, I have used the correct path in unix   %let dir= Y/M/N;

 As I say before, the code does the job well for a small file, but it does not work for a big file ( more than 2 GB)

 

%let dir= Y/M/N;

X cd &dir;

filename pipe "unzip  BIG_FILE -d  REP/BIG_FILE";

Kurt_Bremser
Super User

Don't do a separate cd; instead use fully qualified filenames in the filename pipe. An external change directory will most probably have no effect on the current working directory of the SAS session.

LineMoon
Lapis Lazuli | Level 10

Thank you for your answer.

Please,

what is the impact of using "separate CD" in that ?

Can you explain " use fully qualified filenames in the filename pipe" ?

 

I observe that, If I do not use a cd, I get a strainge result for a small file, but it does not work for a big file

 

filename pipe "unzip V1/V2/V3/W1/W2  SMALL_FILE -d  V1/V2/R/L/Small_FILE";

 

Is it possible to unzip a big file by sas without using Unix command.

 

Thank you again

 

Reeza
Super User

Does the line work outside of SAS, can you unzip the file successfully at all?

LineMoon
Lapis Lazuli | Level 10

Thank you for your answer.

I will check.

For information, the line command works for a small file in sas

Kurt_Bremser
Super User

First of all, just read the documentation: http://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1dn0f61yfyzton...

The ZIP Access Method only works for files compressed with WinZip.

What's so bad about using the right tool for unzipping files? UNIX features all tools necessary for uncompressing, so use them.

 

Regarding the "separate cd": UNIX keeps the current working directory in an environment variable (PWD) of the current process. When you use cd in a separate step, you might just change the PWD there, but (in a later step) end up in the initial working directory of the SAS process, as the environment of the subprocess where the cd was performed is lost. Therefore I recommend to use fully qualified path names for the files in the unzip command. A fully qualified path name is one that starts at the root directory - with a slash.

Never assume, take full control.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 17 replies
  • 1317 views
  • 6 likes
  • 5 in conversation