New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
goti9234
Fluorite | Level 6

I am writing a code to read off a zip file using 7zip. I have successfully done the same. However, the code makes the command prompt to open and doesn't generate the dataset entirely unless I manually close the command prompt. Is there any way in which the command prompt can be closed automatically?

 

libname Orders "D:\Gautham\ISB\Ram\BSE Project\Data\Orders\SAS\Temp";

filename zipfile PIPE '7za e "D:\...\OISBHHY_060513.zip" "OISBHHY_060513" -y -so';

/*Code for reading File from Zip File*/

data Orders.Raw_Data;
	infile zipfile dlm = '|' dsd lrecl = 1024 truncover obs = 10;
	input tradesession symbol tmc cmc:$12. 
cat:$8. bors:$1. ordtype:$1. lp vo vd
timestamp:$50. retention acttype:$1. orno:$30. actionid:$30.; run;

 

8 REPLIES 8
Reeza
Super User
If the file is zip, have you tried the filename zip option instead? You don't have to extract it then.
https://blogs.sas.com/content/sasdummy/2015/05/11/using-filename-zip-to-unzip-and-read-data-files-in...
goti9234
Fluorite | Level 6

Yes, I have tried it. These are files that have been generate on Unix so they only open with 7ZIP. They are really large files as well. Hence, I don't want to unzip them, read them and delete the unzipped one.

Reeza
Super User
This approach doesn't require you to unzip the files at all. I thought SAS added support for GZIP in the last update, if you're on M5+ at least.

Isn't your current process unzipping and reading it, but using the OS instead of SAS?
Tom
Super User Tom
Super User

What are you settings for the XWAIT and XSYNC options?
Also is 7za an actual executable program or some type of shell script?

goti9234
Fluorite | Level 6

7za is an executable program. It's the command line version of 7zip. I have tried the code with the following addition as well:

 

options noxsync noxwait;

The program still does not work. 

Tom
Super User Tom
Super User

I don't know what version of 7zip you have. The version 9.20 I have does not include a 7za.exe file.

If I try to use the 7z.exe to extract a file to std output like your command line then 7Z complains.

C:\>"C:\Program Files\7-Zip\7z.exe" e "c:\downloads\7ztest.zip" "class.txt" -y -so

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18


Error:
I won't write data and program's messages to same terminal

C:\>

Perhaps that is the difference between 7za and 7z commands?

Reeza
Super User
I assumed 7za is a custom shortcut/alias
Tom
Super User Tom
Super User

Looks like 7za.exe was removed back in 2006 time frame.

https://www.7-zip.org/history.txt

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1503 views
  • 2 likes
  • 3 in conversation