DATA Step, Macro, Functions and more

Reading winzip file in SAS linux

Reply
Frequent Contributor
Posts: 99

Reading winzip file in SAS linux

Hi everyone,
I have a winzip file, i want to read using sas linux. I am geting error.
code:

filename zip1 saszipam '/test/temp1.zip ';
DATA unzip1;
INFILE zip1(temp1.txt) MISSOVER lrecl=32767 obs = 2;
input temp $60;
run;

Error.

ERROR: Invalid data length.
FATAL: Unrecoverable I/O error detected in the execution of the DATA step

Please guide me how i can read the data.

Thanks,

Amit
Super Contributor
Super Contributor
Posts: 3,174

Re: Reading winzip file in SAS linux

Hello - straight from the SAS-hosted tech notes documentation at http://support.sas.com/ here is a document reference I found useful for your circumstances.

Scott Barry
SBBWorks, Inc.

Usage Note 31244: SASZIPAM access method - use at your own risk.
http://support.sas.com/kb/31/244.html
Contributor lu
Contributor
Posts: 23

Re: Reading winzip file in SAS linux

HI, Amit
saszipam work only on windows hosts(SAS use dll ).

to read zip file on sas linux you can use pipe in filename statment.
something like

filename zip1 pipe 'unzip -p /test/temp1.zip temp1.txt';

lu.
Frequent Contributor
Posts: 99

Re: Reading winzip file in SAS linux

Hi Lu,
Thanks for your response. I have a few questions.

What will your statement do, will it unzip and create a text file.

filename zip1 pipe 'unzip -p /test/temp1.zip temp1.txt';

These is what I would like to do:

1> Read one observation from the zipped file, to get the variables. ( they are separated by |)
2> Then Create a SAS dataset from the zipped file

Thanks for all your help.

Regards,

Amit
Contributor lu
Contributor
Posts: 23

Re: Reading winzip file in SAS linux

Hi

filename statment with pipe read zipped file on the fly ,without creat temp file/s.
'unzip -p /test/temp1.zip temp1.txt' is a linux command pipe contens of temp1.txt(zipped file ) in standart output (stdout)

you can write data step like your zipped file wasn't zipped Smiley Happy

lu
Ask a Question
Discussion stats
  • 4 replies
  • 430 views
  • 0 likes
  • 3 in conversation