BookmarkSubscribeRSS Feed
PaigeMiller
Diamond | Level 26

Using this paper, "A Quick Guide to the WinZip® Command Line Add-On", I am trying to use the ideas to obtain a listing of the files inside a specific .zip file. I am running SAS 9.3 on Windows 7 Professional (64 bit).

In that paper, on page 6, is the following example:

%wzzip(

zipfile = C:\WZ_Test\Zipped Text Files.zip

,options = -vb >"C:\WZ_Test\ZipInfo.txt"

);

So, I replace the zipfile option with the location of my exact file; and I replace the options= with the location where I want the text file to be, and I run the SAS code. It doesn't work, and I get no error messages in the SASLOG or anywhere else. The desired output file doesn't show up. (Note: in Win 7 64 bit, the WZZIP.exe command is in the location C:\Program Files (x86) instead of C:\Program Files, but I have corrected the code for that).

In the SASlog, there is actual DOS code generated that can be copied and pasted into a DOS window. So, I try that, and the command works in DOS.

So I conclude that there is something in SAS and/or Windows 7 that is preventing the code from executing properly inside SAS. But I have no idea what, or where to look. I welcome your suggestions.

--
Paige Miller
6 REPLIES 6
Tom
Super User Tom
Super User

Your filename has embedded spaces.  Try quoting it.  (or have the macro do it)  The QUOTE function is good for this.

Another issue I have had with other programs is that environment variables are different when run from command shell than when running from within SAS.

PaigeMiller
Diamond | Level 26

Tom wrote:

Your filename has embedded spaces.  Try quoting it.  (or have the macro do it)  The QUOTE function is good for this.

Another issue I have had with other programs is that environment variables are different when run from command shell than when running from within SAS.

My file name does not have space(s) in it, and quoting or not doesn't seem to make a difference.

I don't understand the comment and environment variables, how could I find the environment variables used in the command shell?

--
Paige Miller
Tom
Super User Tom
Super User

Sure looks like a space between the d and the T and another between the t and the F.

From the command line you might need to enclose that filename in quotes to prevent the parse from thinking it was either multiple files or command parameters.

wzzip -vb "C:\WZ_Test\Zipped Text Files.zip"

Similarly the path the directory with the wzzip executable might have embedded spaces.

PaigeMiller
Diamond | Level 26

Tom, that's the example in the paper with the spaces. Trust me, there are no spaces in my files names.

I will check the environment variables as you suggest.

--
Paige Miller
Tom
Super User Tom
Super User

You can use the set command with no arguments to get a list of the environment variables.

One example that I had problems with environment variables was on a Unix system.  A program that I wanted to call from within SAS assumed that the environment variable TEMP pointed to a directory where it could store temporary files.  But the script that I was using to run SAS had already used that environment variable to point to a file instead of a directory.  So I had to include an unset TEMP command in the command string that I called from within SAS to get the program to run properly.

Ksharp
Super User

Could you use filename + pipe ?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 2729 views
  • 0 likes
  • 3 in conversation