BookmarkSubscribeRSS Feed
Konakanchi
Calcite | Level 5

I am trying to read a pipe delimited file from gzip into SAS. I have used the below code.

 

x "cd C:\Program Files (x86)\GnuWin32\bin"; /* to enable to run gzip command*/

 

FILENAME READER PIPE "gzip -cd &PATH.\Rawdata\File.gz";

 

DATA &LIB..&DSN. (COMPRESS=YES) ;
INFILE READER DELIMITER = '|' TRUNCOVER DSD LRECL=32767 FIRSTOBS=1 OBS=10;

 

There is a command prompt window showing up and unless i close it, the program isn't running further. Is there any way to close the cmd windows closes automatically or is there any way to stop this window coming up?

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

options noxwait:

http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n0xwt90ik8vxdrn137...

 

Do please avoid coding all in shouting case, it makes code hard to read, and you can use the code window - its the {i} above post are - so that essential code formatting is retained.

 

Konakanchi
Calcite | Level 5

I have used Options Noxwait; in the beginning of the program and don't see any changes. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I would unzip the file before assigning it to a read.  So something like:

/* Send command to expand files */
x "C:\Program Files (x86)\GnuWin32\bin\gzip.exe -cd -f "c:\somewhere\Rawdata\File.gz";

/* Now read in the extracted files */
data want;
  infile "c:\somewhere\Rawdata\thefile.txt" dlm="|" truncover dsd lrecl=32767;
  input ...;
run;

Your code seems to be reading the command line rather than actually expanding the data then reading a file, which may also be the root of your problem.  I.e. you don't push piped command line strings directly into a read, infile expects a file, not an action.  

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2424 views
  • 0 likes
  • 3 in conversation