Hi all,
As we know that sometimes the dataset is too big, so I have some zipped sas7bdat datasets (with .gz tail). I did a search to find a way to import the zip file thAT I can work with this sas7bdat file without losing too much space in the hard drive.
However, I found this link saying that I need to unzip the zip file. However, I also find another SAS document saying that we can import the dataset from ipped file.
Before digging further, I want to ask if I follow the later document, if I read the data from the zipped file directly, whether SAS also need to unzip this file and then cost the memory?
Thank you in advance.
So first thing is that you have GZIP file, not a ZIP file. A ZIP file is an archive that can contain multiple individual files. A file that has been compressed with GZIP is just a single file.
You can use the ZIP filename engine to read a GZIP file, but you cannot at the same time try to access the uncompressed file as a SAS dataset. So you will have to uncompress the file first before you can read the data out of it. You can use your local operating system command to uncompress the file or you can use SAS code to first uncompress the file.
Is space is a major issue then it might work better to have a text file, like a CSV file. Then you could read the lines of text directly from the compressed version using the ZIP filename engine with the GZIP option. But then you would need to have a program that knows what columns the text files has and how to read them as there is no place in a CSV file to store the metadata about the variables.
So first thing is that you have GZIP file, not a ZIP file. A ZIP file is an archive that can contain multiple individual files. A file that has been compressed with GZIP is just a single file.
You can use the ZIP filename engine to read a GZIP file, but you cannot at the same time try to access the uncompressed file as a SAS dataset. So you will have to uncompress the file first before you can read the data out of it. You can use your local operating system command to uncompress the file or you can use SAS code to first uncompress the file.
Is space is a major issue then it might work better to have a text file, like a CSV file. Then you could read the lines of text directly from the compressed version using the ZIP filename engine with the GZIP option. But then you would need to have a program that knows what columns the text files has and how to read them as there is no place in a CSV file to store the metadata about the variables.
Instead of using an external utility, test the COMPRESS=YES and COMPRESS=BINARY dataset options.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.