BookmarkSubscribeRSS Feed
Demoxe
Calcite | Level 5

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?

10 REPLIES 10
SASJedi
SAS Super FREQ

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.

Check out my Jedi SAS Tricks for SAS Users
Demoxe
Calcite | Level 5

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?

Ksharp
Super User

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

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

Ksharp

Demoxe
Calcite | Level 5

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.

SteveDenham
Jade | Level 19

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

Demoxe
Calcite | Level 5

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.

Tom
Super User Tom
Super User

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.

Demoxe
Calcite | Level 5

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";) 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.

Ksharp
Super User

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

Demoxe
Calcite | Level 5

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)

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 10 replies
  • 1511 views
  • 1 like
  • 5 in conversation