Help using Base SAS procedures

7za' is not recognized as an internal or external command

Accepted Solution Solved
Reply
Contributor
Posts: 56
Accepted Solution

7za' is not recognized as an internal or external command

Hello everyone,

I am new to the community so handle with care :smileygrin:

I need some help importing data into SAS.

I am using compressed files and when I use SASZIPAM I end up having error messages "invalid data length"

So now I am trying to open them using PIPE command;

here is my code

FileName zipfile PIPE '7za e "c:\sas_data\my_notes\o_equities_20080528.tas.zip"

"o_equities_20080528.tas" -y -so';

Data dataset;

Infile zipfile dlm= ',' MISSOVER DSD firstobs=6;

input time  dum cpf  label  ED vol ba price;

run;

However I get this error message

Stderr output:

'7za' is not recognized as an internal or external command,

operable program or batch file

Please help;

Thank you in advance.


Accepted Solutions
Solution
‎01-05-2014 03:24 PM
PROC Star
Posts: 7,356

Re: 7za' is not recognized as an internal or external command

Is your filename statement on 1 line or 2?

The following worked for me (in case it wraps, the entire filename statement is on one line):

FileName zipfile PIPE 'C:\Bch\7za.exe e "c:\sas_data\my_notes\o_equities_20080528.tas.zip" "o_equities_20080528.tas" -y -so';

Data datbase;

  infile zipfile dlm= ',' MISSOVER DSD firstobs=2;

  input name $ sex $ age height weight;

run;

View solution in original post


All Replies
Super User
Super User
Posts: 6,495

Re: 7za' is not recognized as an internal or external command

Do you have the 7Zip program installed?  Is the search path set to include the directory where the 7za executable is?  If you do have it then perhaps all you need do is to add the path to the command.

filename zipfile PIPE '"c:\program files\somedirectory\7za.exe" e "c:\sas_data\my_notes\o_equities_20080528.tas.zip"

"o_equities_20080528.tas" -y -so';

Contributor
Posts: 56

Re: 7za' is not recognized as an internal or external command

Thank you Tom,

I will try it now and let you know the outcome.

Thanks a lot!

Contributor
Posts: 56

Re: 7za' is not recognized as an internal or external command

Hello Tom,

Sorry to bother you again but I have been trying with your solution and I always get this error message

Stderr output:

The filename, directory name, or volume label syntax is incorrect

This is the code I used;

FileName zipfile PIPE '"C:\Program Files\7-Zip\7z.exe" e "c:\sas_data\my_notes\o_equities_20080528.tas.zip"

"o_equities_20080528.tas" -y -so';

I don't understand the error here.

Many thanks

PROC Star
Posts: 7,356

Re: 7za' is not recognized as an internal or external command

Is the program called 7z.exe or 7za.exe?  You have it shown the two different ways in your two posts.

Contributor
Posts: 56

Re: 7za' is not recognized as an internal or external command

Hello Arthur,

In my 7-zip folder there are actually 3 .exe applications

7z.exe 7zG.exe and 7zFM.exe

I thought that 7za,exe and 7z.exe are both 7zip applications.

PROC Star
Posts: 7,356

Re: 7za' is not recognized as an internal or external command

I was able to get it to work as follows:

1. Download the command line version of 7zip (i.e., 7za.exe) at:

http://downloads.sourceforge.net/sevenzip/7za920.zip

2. Copy and paste the four files into some directory (I put them in c:\art)

3. Run your code as you originally did.  I used:

filename zipfile PIPE 'c:\art\7za.exe e "c:\art\class.7z" "class.csv" -y -so';

data dataset;

  infile zipfile dlm= ',' MISSOVER DSD firstobs=2;

  input name $ sex $ age height weight;

run;

Contributor
Posts: 56

Re: 7za' is not recognized as an internal or external command

Hello Arthur,

Here is the code following your useful advice,

FileName zipfile PIPE '"C:\Bch\7za.exe" e "c:\sas_data\my_notes\o_equities_20080528.tas.zip"

"o_equities_20080528.tas" -y -so';

Data dataset;

Infile zipfile dlm= ',' MISSOVER DSD firstobs=6;

input time  cpf $ label $ ID vol ba$ price;

run;

However I keep getting this output:

Stderr output:

The filename, directory name, or volume label syntax is incorrect

What am I doing wrong? Is it maybe the .tas file??


Sorry for the headache Smiley Happy

PROC Star
Posts: 7,356

Re: 7za' is not recognized as an internal or external command

I don't think you need the double quotes around: "C:\Bch\7za.exe"

However, I don't think that is your real problem.  Are you sure that

c:\sas_data\my_notes\o_equities_20080528.tas.zip is the actual name of the zipped file and are you sure it contains the file:

o_equities_20080528.tas

Solution
‎01-05-2014 03:24 PM
PROC Star
Posts: 7,356

Re: 7za' is not recognized as an internal or external command

Is your filename statement on 1 line or 2?

The following worked for me (in case it wraps, the entire filename statement is on one line):

FileName zipfile PIPE 'C:\Bch\7za.exe e "c:\sas_data\my_notes\o_equities_20080528.tas.zip" "o_equities_20080528.tas" -y -so';

Data datbase;

  infile zipfile dlm= ',' MISSOVER DSD firstobs=2;

  input name $ sex $ age height weight;

run;

Contributor
Posts: 56

Re: 7za' is not recognized as an internal or external command

Indeed I did not need the double quote.

That solved this error

Stderr output:

The filename, directory name, or volume label syntax is incorrect

I am sure about the file names but I keep getting another error

Error:

cannot find archive

I am sure about the file location.

I am very thankful for your help, Arthur!

PROC Star
Posts: 7,356

Re: 7za' is not recognized as an internal or external command

You marked the question as correct thus I'm not sure if you got your answer or not.

The code worked for me using the filenames you provided but, of course, I'm not running on your machine.

If it still isn't working, and you are submitting the entire filename statement on one line, then the only thing I can suggest is your getting a listing of the directory you are pointing to (which holds the archive) and quadruple check whether the entire path and archive name are correctly entered on your filename statement.

Contributor
Posts: 56

Re: 7za' is not recognized as an internal or external command

The answer is correct for these error messages which were the main issue for me.

Stderr output:

'7za' is not recognized as an internal or external command,

operable program or batch file

Stderr output:

The filename, directory name, or volume label syntax is incorrect

I thank you for that! You are very helpful indeed.

I copy the path and the files names so I am sure about their location and names. I will try to have them on a separate folder with shorter paths and see if it works.


Many thanks.

Contributor
Posts: 56

Re: 7za' is not recognized as an internal or external command

Dear Arthur,

It worked perfectly.

You were right. The file statement should be in 1 line not 2.

Thank you very much.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 13 replies
  • 6356 views
  • 3 likes
  • 3 in conversation