- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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';
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Tom,
I will try it now and let you know the outcome.
Thanks a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is the program called 7z.exe or 7za.exe? You have it shown the two different ways in your two posts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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:
data dataset;
infile zipfile dlm= ',' MISSOVER DSD firstobs=2;
input name $ sex $ age height weight;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dear Arthur,
It worked perfectly.
You were right. The file statement should be in 1 line not 2.
Thank you very much.