BookmarkSubscribeRSS Feed
Calcite | Level 5

I like reading in streams of data like

filename IN1 '.\*.log';
data work.test;
attrib filename fn length=$256;
retain filename;
infile in1 filename=fn eov=eov length=l;
input line $varying200. l;
if _n_ eq 1 or eov then do;
filename = fn;
eov = 0;

and I learned about zip files using

filename inzip zip "&ziploc";

I there a way to read all (similar) data files from a zip file as a stream, like


data allData;
infile InZip(*.csv) ...;


Diamond | Level 26 RW9
Diamond | Level 26

Sorry, question is a bit unclear.  You have a set of CSV files, do you want the CSV files themselves to be added to a ZIP file?  Or do you want the datasets you create from reading in the CSV files to be put into a ZIP file?  There is a difference.  Generally if you have files and want to put them in a zip then you would use the OS to do this (either by select all files and then add to zip or by x commands).  If you want the data to a zip, then you can use ods package to create and add files to a zip via SAS per:

Calcite | Level 5

reading it. thanks. Guess there is no way around to copy the csv files out of the zip file and then read them in.


So the set-up is one zip file with a lot of csv-files in that have the same columns.

Diamond | Level 26 RW9
Diamond | Level 26

If thats the case, then you would have setup an import process for the zip file would you not?  I.e. your data transfer documentation would detail where you will save the ZIP file, how you will ensure the files are all extracted correctly, possibly it will also tell you how you will protect those files - i.e. so if you need to go back to them you can always do this.  Hence that data import (and validation) process would take care of getting the files ready, so nothing SAS related, in SAS you would just read in the data.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 in conversation