DATA Step, Macro, Functions and more

SAS DIS and x statement

Reply
Contributor
Posts: 22

SAS DIS and x statement

Hello, I've got a problem with execution of x statement in SAS DIS.

So, there is a server under Windows with metadata and other computers with SAS DIS on them. I made a job, that essentially runs a command on the server to execute a Visual Basic script. This script should start a process Excel.exe, that writes some data in .xls report. So, I've this code in my job:

options XSYNC;

data _NULL_;

   x "cscript D:\Reports\vbs\report.vbs";

run;

And here is a problem: this code executes under 30 seconds and without any changes to .xls report. When I simply use same command in console on the server, it works for about ten minutes and .xls report changes. Sadly, I can't (at least don't know how) track, does cscript start Excel.exe or not, when the job is working. As far as a person responsible for this server knows, there isn't any obstacles from firewalls and so on. Can anybody suggest, what's wrong with this code?

SAS Employee
Posts: 104

SAS DIS and x statement

Your SAS code looks OK, but many things can affect using SAS X commands in a client-server environment. 

The first step is to be able to see what the problem is with the script execution.  Try piping the results of the script execution to a file, something like this:

options XSYNC;
data _NULL_;
   x "cscript D:\Reports\vbs\report.vbs > D:\Reports\vbs\report_log.txt";
run;

Review the contents of D:\Reports\vbs\report_log.txt after your code executes for clues as to what went wrong.

Contributor
Posts: 22

SAS DIS and x statement

It was a good idea, but still no luck. I've tried this code in my job - no log-file was created. I've tried this code in SAS 9.1 - it opens a console window and writes something about windows script server and copyrights, as if the command about piping log was simply ignored. I've tried this command in the console - it worked and text about server and copyrights was written in the log-file, but there was never any problem with executing VB script this way. I've got a feeling, that SAS itself has some problems with affecting several files through console or something like that. Any more ideas?

Super User
Posts: 9,681

SAS DIS and x statement

I doubted that your SAS Administrator has forbidden the pipe function.

So Contact SAS Administrator whether SAS forbid the ability of x statement.

Ksharp

Contributor
Posts: 22

SAS DIS and x statement

Before this problem with cscript I used x statement to add .xls report to archive, and this command worked perfectly. I think, it indicates that x statement isn't forbidden.

Respected Advisor
Posts: 2,655

SAS DIS and x statement

Is it as simple as the default time for the x command to 'sleep'?  The behavior sounds kind of like the x command is closing before the task is completed.  I'm just guessing on this one, and I am sure that you have checked it out, but if not, maybe there is a solution.

Steve Denham

Contributor
Posts: 22

SAS DIS and x statement

Well, maybe, but I didn't find any mention of such default time of execution for x statement in the manual. Besides, x statement with cscript works a lot longer in SAS 9.1 than in DIS, so this limitation exists only in DIS? It seems unlikely, but I would happily be proven wrong.

Super User
Super User
Posts: 6,500

SAS DIS and x statement

Make sure that you have permission to run X command on the DIS server.

Try running another program that does a different command.

For example:

x "echo hello > %sysfunc(pathname(work))\hello.dat" ;

data _null_;

  infile "%sysfunc(pathname(work))\hello.dat";

  input; list;

run;

If that works then try to find out if you have permission to run the cscript command on the server.

Contributor
Posts: 22

SAS DIS and x statement

As I said earlier, I've used x statement in SAS DIS to add .xls report to archive (x "'c:\Program files\WinRar\Rar.exe' a D:\Reports\report.rar D:\Reports\report.xls"Smiley Wink and this command worked, so I have the permission to run x command on the server. Administrator insists, that there isn't anything on the server that can prevent me from running cscript command.

Super User
Posts: 9,681

SAS DIS and x statement

I doubted that the user of SAS client is different from the user of console.

The user of SAS client is internal account? and the user of console is actually Operation System user,

So maybe the user of SAS client has not this right.

If you could , try to use SAS Administrator account to test your code.

Ksharp

Contributor
Posts: 22

SAS DIS and x statement

Administrator executed my code in SAS 9.1 under my user and everything was right, then he executed the same code under my user in SAS DIS and again no changes in .xls report. In the end it's been decided to use the scheduler to bypass this problem. And now it's all put on hold until everything is approved.. so thanks for help)

Ask a Question
Discussion stats
  • 10 replies
  • 363 views
  • 1 like
  • 5 in conversation