Help using Base SAS procedures

SAS x command with 7-zip in batch mode

Reply
Contributor
Posts: 36

SAS x command with 7-zip in batch mode

Hi.

I have trouble running 7-zip with the x command in SAS batch mode. I can run the below code in the SAS standard way (interactive mode), but not in batch mode. Is it possible to go around?

   

options noxwait xsync;

* Below line does not work i batch mode, but in SAS interactive mode;

x "c:\progra~1\7-zip\7z.exe a c:\a\b.zip C:\b\b.csv";

* Below line works in both batch mode and SAS interactive mode;

x "&mikeripath\Documents\Karolinska\Karma\data\sftp\pscp.exe -pw yyy c:\c\*.*
zzz@cu.se:/c/"
;

Super User
Super User
Posts: 6,499

Re: SAS x command with 7-zip in batch mode

One debugging tool is to use a PIPE so that you can see any error messages that operating system or program is generating.

data _null_;

  infile "c:\progra~1\7-zip\7z.exe a c:\a\b.zip C:\b\b.csv" pipe ;

  input ;

  put _infile_;

run;

Trusted Advisor
Posts: 2,113

Re: SAS x command with 7-zip in batch mode

Are you using the same SAS server for interactive and remote?  If one is remote, it probably can't see your c: drive.

Contributor
Posts: 36

Re: SAS x command with 7-zip in batch mode

Hi. I noticed that 7-zip was not allowed to update the existing b.zip when SAS run in batch mode, although it was allowed to do it in standard interactive mode. An x command delete statement before the 7-zip statement solved it.

Ask a Question
Discussion stats
  • 3 replies
  • 1369 views
  • 0 likes
  • 3 in conversation