Desktop productivity for business analysts and programmers

SAS Automation

Reply
Frequent Contributor
Posts: 97

SAS Automation

I have written a vbscript to run SAS code file in EG. I have set up the server to automatically run the vbscript. Both of these work fine on my computer. However, when I try to set up the server to automatically run the vbscript, it fails because the task is being run by the SASAdmin account, and I get the error cannot connect to SASMain. I am not sure if this is standard for EG, but EG is set up to check the info in the personal login manager against the account info you used to log into windows.

My question is, in the vbscript, when I call the sasprogram, can I set the credentials for SAS so it runs on the server, but uses my credentials. I can enter my username and password, and then compile the script as an exe. Here is my code:

On Error Resume Next
ProjectName = "\\Nasvs1\Shared\4700Mac\Shared3\Actuarial\SAS\Projects\Refresh.egp"
Files = Array("LIBNAMES", "DAILY")
Call Work(ProjectName, Files)

Sub Work(ProjectName, Files)
Set App = CreateObject("SASEGObjectModel.Application.4")
Set Project = App.Open(ProjectName,"")
Set Container = Project.CodeCollection
For Each File In Files
For Each Object In Container
If Object.Name = File Then Object.Run
Next
Next
Project.Save
Project.Close
End Sub

Any help is greatly appreciated.
Thanks,
Chris
Christopher Johnson
www.codeitmagazine.com
Community Manager
Posts: 2,884

Re: SAS Automation

Chris,

Try the instructions in:

http://support.sas.com/kb/30/917.html

This will require that you have the most recent hotfixes for EG 4.1.

Chris
Frequent Contributor
Posts: 97

Re: SAS Automation

Thanks. I could not find any articles concerning what I wanted to do. If I understand correctly, when the credentials file is in place, and I schedule a sas process, the vbscript file it generates should now have code added to pass the credentials to sas. I have tried this, and it did not add any code and it still does not run. Any idea what code it adds to the vbscript file?

Thanks again,
Chris
Christopher Johnson
www.codeitmagazine.com
Community Manager
Posts: 2,884

Re: SAS Automation

The way this works is the automation process looks for the credentials file at runtime, and if it exists it tries to use the contained credentials to connect to resources (metadata, workspace, etc.).

The VBScript code does not change at all. The presence of the file with the correct contents is all you need. However, the file needs to be located in the profile area of the account that is actually running the automated process.

Chris
Frequent Contributor
Posts: 97

Re: SAS Automation

I have worked with my server administrator for several days, and we can not find a permanent way to make this work. The admin needs to run this task as administrator or sasadm, rather than under my credentials, so the password does not change, and the script runs automatically. However, I need to run the sas code under my credentials.

I have created the credentials.xml file the paper describes using my username/password. Is there any way to run this file or pass its values through the vbscript?
Christopher Johnson
www.codeitmagazine.com
Frequent Contributor
Posts: 97

Re: SAS Automation

I had another thought about this. In batch mode, I am able to start the application and choose a code file. The error occurs when I try to run that code file, since I have no connection to the server. Is there a way to choose the server, and set the credentials in the process?
Christopher Johnson
www.codeitmagazine.com
Community Manager
Posts: 2,884

Re: SAS Automation

You can choose the server, but not credentials.

If the instructions don't work for you, please contact SAS Technical Support so that the problem can be tracked.

Chris
Ask a Question
Discussion stats
  • 6 replies
  • 431 views
  • 0 likes
  • 2 in conversation