Help using Base SAS procedures

Importing Files from .zip

Reply
Occasional Contributor
Posts: 16

Importing Files from .zip

Hello there,

I was wondering if it was possible to import .dat files from inside a .zip folder.

The only way I've been able to manage the import is by copy and pasting these files out of the zip folder.

I've been using an infile statement to import...

Data work.dat;

Infile
'\\int\Updates\folder\SPEC.dat' LRECL = 452 Firstobs = 2;

Input
...;
Keep ....;
Run;


Thanks Guys!
Super Contributor
Super Contributor
Posts: 3,174

Re: Importing Files from .zip

From the SAS support website, here is an SGF conference paper on the topic of reading compressed files:

http://www2.sas.com/proceedings/sugi31/155-31.pdf

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:
read zip files site:sas.com
Occasional Contributor
Posts: 16

Re: Importing Files from .zip

Had a read of that Scott and I can't work out how to use it or change it to what I need...

(extract)
"...let’s put all you need in the same directory: the SAS programs we are
going to test, the uncompressed text files, the archives (compressed files) and the tools 7za.exe and gzip.exe...."

I think if I asked for the IT guys here at work if I could do that their heads would explode.

This is what I've been trying to run and getting an ERROR: Insufficient authorization to access c:\windows\system32\11022011.zip. The thing I don't fully understand is where in my script am I asking for it to look in that directory.


Options nodate noxwait;
%Let MyDir = \\int\Collaborate\PI\Portfoli\FTP Transfer;
x "&MyDir";
FileName FTPTRANS Saszipam "11022011.zip";

Data Rwork.GIOSPEC (index = (Nvic));
Infile FTPTRANS (GIOSPEC.dat)
LRECL = 452 Firstobs = 2;
%Let _EFIERR_ = 0;
Input ....

Thanks for your help mate.

Sam
Frequent Contributor
Posts: 106

Re: Importing Files from .zip

What was that "x" command (having just a path/directory as an argument) supposed to do?
Ask a Question
Discussion stats
  • 3 replies
  • 1145 views
  • 0 likes
  • 3 in conversation