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.  

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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