BookmarkSubscribeRSS Feed
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

I had a small question on the filename zip which can no read in directly from ZIP files in 9.4.  The examples I have seen all deal with using this to read in text based files, e.g.

filename fromzip zip 's:\temp\rob\rob.zip' member="test.txt";

data temp;

  infile fromzip;

...

run;

My question is, can this methodology read in SAS datasets from a ZIP file.  Historically we would have the process of running a system unzip statement on the file and I am wondering if we can skip that and just read the datasets directly from the ZIP something like (with test being a sas7bdat file):

filename fromzip zip 's:\temp\rob\rob.zip';

data temp;

  set fromzip.test;

run;

3 REPLIES 3
Kurt_Bremser
Super User

You need fromzip to be a library, not a fileref.

Since one cannot use a fileref (which would point to the .zip) as the path to assign a libname to, this could not work syntactically.

Unless you have external software that "mounts" the zip file like a subdirectory, you can't directly read a SAS dataset from the .zip, so extracting the dataset(s) from the zipfile first and then reading them will still be the only option.

Remember that we also could not use filename x ftp "path" .... to directly access SAS datasets on a remote host.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Thanks.  Yes, Windows under the hood can just read anwrite directly to ZIPs as if they were directories, was kind of hoping to do the same in SAS.  Its simple enough to have a small VB script to copy the files out, may just go with that as the files are not directly being used in SAS at the point of receipt, so doesn't need to be done there.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 522 views
  • 3 likes
  • 2 in conversation