BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hellohere
Pyrite | Level 9

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;

1 ACCEPTED SOLUTION

Accepted Solutions
japelin
Rhodochrosite | Level 12

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.

View solution in original post

7 REPLIES 7
ChrisNZ
Tourmaline | Level 20

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.

japelin
Rhodochrosite | Level 12

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.

hellohere
Pyrite | Level 9

Thanks every one. I tried above at prompt and it works. 

hellohere
Pyrite | Level 9

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?!

japelin
Rhodochrosite | Level 12

use noxwait option.

 

options noxwait;
AllanBowe
Barite | Level 11

You can unzip without the use of X command using this macro: https://core.sasjs.io/mp__unzip_8sas.html

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1723 views
  • 5 likes
  • 5 in conversation