I am using "x tar" to unzip file (PC/WINDOWS). It works but not into the specified directory(e:\outsas), rather
it lands in c:/users/myid. Anyone has idea?
x tar -zxvf e:\20210618.tar.gz index_md_20210618.csv -C e:\outsas;
SAS has nothing to do with it, it's a matter of tar usage.
I recommend that you first make sure that tar can be handled properly at the command prompt without using x statement, and then implement it with sas.
I don't know, I haven't tried it, but the -C option of the tar command may not be supported except for the system drive.
In that case, you can use the cd command and execute the following beforehand.
cd /D e:\outsas
So, if you want to write it in one line, it would look like this
cd /D e:\outsas & tar -zxvf e:\20210618.tar.gz index_md_20210618.csv
Give it a try.
You need to lookup the syntax for tar.
You also need to quote the x command.
You also need to change the title of your post, there's no zip in sight.
The -z option makes tar filter the archive through gzip first.
It's similar to
gzip -dc file.tar.gz|tar -xvf -
SAS has nothing to do with it, it's a matter of tar usage.
I recommend that you first make sure that tar can be handled properly at the command prompt without using x statement, and then implement it with sas.
I don't know, I haven't tried it, but the -C option of the tar command may not be supported except for the system drive.
In that case, you can use the cd command and execute the following beforehand.
cd /D e:\outsas
So, if you want to write it in one line, it would look like this
cd /D e:\outsas & tar -zxvf e:\20210618.tar.gz index_md_20210618.csv
Give it a try.
Thanks every one. I tried above at prompt and it works.
Also tried with SAS. It works. BUT with an issue the prompt stays and SAS chokes up until the prompt exits.
How to exit the prompt automatically?!
use noxwait option.
options noxwait;
You can unzip without the use of X command using this macro: https://core.sasjs.io/mp__unzip_8sas.html
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.