Help using Base SAS procedures

Help with reading files from the folder on Linux

Frequent Contributor
Posts: 124

Help with reading files from the folder on Linux

I am trying to read the files from the folder on Linux using PIPE.  There are currently 2 files (ABC_*.zip) in the folder.  But when I tried to use the following code but it does not work.  What may be wrong in the code? %let extl_dir=/PROD/PGM/;   filename zl pipe "ls &extl_dir.ABC_*.zip";   data ziplist_a;   infile pl  end=last;   length path $200 zipnm $50 filedt $15;   input path $;   zipnm=scan(path,-1,"/");   filedt=scan(scan(path,-1,"_"),1,".");   call symput('zip'||left(_n_), zipnm);   call symput('path'||left(_n_), path);   call symput('filedt'||left(_n_),filedt);   if last then call symput('num_zip',_n_);     run; NOTE: Numeric values have been converted to character values at the places given by: (Line)Smiley SadColumn).       97:25    98:26    99:28    100:36 NOTE: The infile ZL is:       Unnamed Pipe Access Device,       PROCESS=ls /PROD/PGM/ABC_*.zip,       RECFM=V,LRECL=256 Stderr output: 'ls' is not recognized as an internal or external command, operable program or batch file. NOTE: 0 records were read from the infile PL. NOTE: The data set WORK.ZIPLIST_A has 0 observations and 3 variables. NOTE: DATA statement used (Total process time):       real time          0.07 seconds       cpu time            0.03 seconds

Frequent Contributor
Posts: 124

Re: Help with reading files from the folder on Linux

Any Help???

Super User
Posts: 5,308

Re: Help with reading files from the folder on Linux

This is a community, not a free support site. If you need immediate help, hire a consultant.

Also, it's easier to help if you provide logs that are readable. Have them in an attachment if you got problem pasting them into the text input field in the browser.

So how are you executing this code? From a Linux shell command prompt, Enterprise Guide connection, or?

Since it seems you are not executing the pipe in Linux.

To narrow down the problem, test to put the path explicitly in the pipe string (avoid the macro variable). The test the exact same command on a Linux shell prompt.

Data never sleeps
Respected Advisor
Posts: 3,147

Re: Help with reading files from the folder on Linux

If you are on SAS 9.4, then try to leverage the ZIP access method.


Otherwise, you will have to resort the third party software, here is a good paper:

Good Luck,


Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation