SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to infile .gz files

Accepted Solution Solved
Reply
Super Contributor
Posts: 266
Accepted Solution

How to infile .gz files

[ Edited ]

Hi every one .... please help me to use .gz file attached along with this.

i need to use it by infile and i am working on windows

 

please help me

 

my code is

 

filename hhh pipe "zcat filepath\test.txt.gz";
  
  data test;
    infile hhh firstobs = 2 expandtabs truncover;
    input @1    dd1 yymmdd10.
          @17   dd2 yymmdd10.
          @33   act $1.
          @41   udu 1.
          @49   LC $5.
          @57   cs $3.
          @65   sc $3.
          @73   div 1.
          @81   vol;
    format dd1 dateto date9.;
    area=trim(left(lc));
    if lc=' ' then error 'NO AREA LISTED';
    
  run;

Log window:

 

Stderr output:
'zcat' is not recognized as an internal or external command,
operable program or batch file.
NOTE: 0 records were read from the infile HHH.
NOTE: The data set WORK.TEST has 0 observations and 9 variables.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.04 seconds

 

Attachment

Accepted Solutions
Solution
‎06-28-2017 11:24 AM
Respected Advisor
Posts: 4,173

Re: How to infile .gz files

If the zipping tool you want to use is 7zip then you need also to use the syntax for 7zip (zcat is Gzip syntax).

May be this will help you: http://www2.sas.com/proceedings/sugi31/155-31.pdf

View solution in original post


All Replies
Contributor
Posts: 62

Re: How to infile .gz files

Hello,

In filename, you can use PIPE to handle it.

Respected Advisor
Posts: 4,173

Re: How to infile .gz files

Is gzip installed on your Windows machine? Or any other zipping tool like 7zip?

Whatever you're using I doubt that you just can call the tool using "zcat". In order for Windows to find it you must provide a path (absolute or relative) - or 'cd' to the directory where the executable "lives".

May be below links will help:

https://communities.sas.com/message/114760#114760

https://communities.sas.com/message/169460#169460

Community Manager
Posts: 2,953

Re: How to infile .gz files

Super Contributor
Posts: 266

Re: How to infile .gz files

yes 7zip installed on my machine... still havining error

 

Stderr output:

'zcat' is not recognized as an internal or external command,

operable program or batch file.

NOTE: 0 records were read from the infile WANTED.

NOTE: The data set WORK.TEST has 0 observations and 9 variables.

NOTE: DATA statement used (Total process time):

real time 0.03 seconds

cpu time 0.00 seconds


Solution
‎06-28-2017 11:24 AM
Respected Advisor
Posts: 4,173

Re: How to infile .gz files

If the zipping tool you want to use is 7zip then you need also to use the syntax for 7zip (zcat is Gzip syntax).

May be this will help you: http://www2.sas.com/proceedings/sugi31/155-31.pdf

Contributor
Posts: 62

Re: How to infile .gz files

I run your code under SAS 9.2. It works !

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 3587 views
  • 3 likes
  • 4 in conversation