DATA Step, Macro, Functions and more

import csv.gz windows

New Contributor
Posts: 2

import csv.gz windows

HI all,

First I downloaded the Gzip:

Gzip for Windows => downloaded: Complete package, except sources

1) In  the command prompt:

                          "C:\Users\sbrpac>"C:\Program Files (x86)\GnuWin32\bin\gzip" -cd "C:\data.csv.gz"

Returned only the first row of the csv only (column names), even though when I open the csv it has more than 1,000 rows.

2) In SAS

                    %let File1="C:\data.csv.gz";

                    %let dir=C:\"Program Files (x86)"\GnuWin32\bin\gzip;

                    Data result_data ;

                         filename file2 pipe %unquote(%str(%'&dir -cd &file1%'));

                        infile file2 dlm="|" LRECL=32767 truncover  dsd firstobs=2;

                        ..... run;

Returned an empty table.

Do you know what might have I done wrong?

Super User
Posts: 13,542

Re: import csv.gz windows

Posted in reply to paulacalazans

Have you tried it without all of the macro variables and quoting functions? As in typing all of the file name without them.

The filename line generated resolves to :

filename file2 pipe 'C:\"Program Files (x86)"\GnuWin32\bin\gzip -cd "C:\data.csv.gz"'

Which has perhaps too many quotes.

You can submit the filename as a separate statement from the data step and see if you get a successful assignment.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation