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; end; run;
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) ...;
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:
http://blogs.sas.com/content/sasdummy/2014/01/28/create-zip-ods-package/
Have you already taken a look at http://blogs.sas.com/content/sasdummy/2015/05/11/using-filename-zip-to-unzip-and-read-data-files-in-...
I guess there are some hints for you in there.
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.