Hello,
I am trying to extract text files that are saved within multiple zip files. For example, I need to extract a text file within a structure such as "C:\Users\myname\Documents\files.zip\specifictextfile.zip\mydata.txt".
In my case, each text file is saved within their own zip file inside "files.zip". I have been able to successfully extract the text file within a single zip level, so something like "C:\Users\myname\Documents\specifictextfile.zip\mydata.txt" but I cannot get it out of the two level zips.
This resource was extremely helpful with extracting from a one level zip: https://blogs.sas.com/content/sasdummy/2015/05/11/using-filename-zip-to-unzip-and-read-data-files-in...
Even if I could just extract the second level zips into their own folder, I could use the code at the link above to extract the text files from there. Does anyone know if this is possible or have any ideas how to do this? I could resort to manually extracting the "files.zip" first then using sas to read the txt files within each "specifictextfile.zip" zip, but I would rather not if possible. Let me know if I can provide additional information to assist with my question. The only example code I have was the code used in the blog to extract from a single zip file so I did not bother including it. Thanks so much.
Nope. Extract the embedded ZIP to a physical file, perhaps in your WORK directory. Then you can extract the files from that ZIP file. Repeat as many times as they have levels of nesting.
That is just a silly way to send data.
They should have just copied the files from the sub-files into the target ZIP as folders. Storing a ZIP file in a ZIP file is just adding work for you without any added value.
Nope. Extract the embedded ZIP to a physical file, perhaps in your WORK directory. Then you can extract the files from that ZIP file. Repeat as many times as they have levels of nesting.
That is just a silly way to send data.
They should have just copied the files from the sub-files into the target ZIP as folders. Storing a ZIP file in a ZIP file is just adding work for you without any added value.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.