DATA Step, Macro, Functions and more

Can I input zipped asc file?

Reply
Super Contributor
Posts: 1,636

Can I input zipped asc file?

Thank you very much!  - Linlin

Respected Advisor
Posts: 4,173

Re: Can I input zipped asc file?

Something like below should work.

filename <fileref> pipe '<unzip command eg. using 7zip or whatever is available>';

data want;

     infile <fileref> ...;

     input...;

run;

Super Contributor
Posts: 1,636

Re: Can I input zipped asc file?

Hi Patrick,

Thank you for your reply. But I still don't know how to write the code.

Respected Advisor
Posts: 4,173

Re: Can I input zipped asc file?

How I would approach this:

1. Using a command prompt get the unzip command right

2. Unzip the file and get the data step right

3. Paste the unzip command into the filename statement (you will have to get the quoting right here).

4. In the infile statement use the fileref so that it points to the pipe where the filename pipe writes to.

Everything here with examples:

http://www2.sas.com/proceedings/sugi31/155-31.pdf

Respected Advisor
Posts: 4,920

Re: Can I input zipped asc file?

From the 7zip help file: the command line should be something like :

7z x yourFile.zip -so

where 7z is the name of the command line version of 7zip, x means extract and -so means write to standard output stream.

hth

PG

PG
Respected Advisor
Posts: 4,173

Re: Can I input zipped asc file?

@Linlin

I possibly don't understand what the "asc" in your question stands for. But the main approach remains: You use a non-SAS command to bring the archive into a shape where you can read it with SAS and you write this to a pipe which you then access via SAS.

Super Contributor
Posts: 1,636

Re: Can I input zipped asc file?

Hi PG and Patrick,

Thank you very much for your help!  - Linlin

Ask a Question
Discussion stats
  • 6 replies
  • 686 views
  • 6 likes
  • 3 in conversation