BookmarkSubscribeRSS Feed
cjohnson
Obsidian | Level 7
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
6 REPLIES 6
ChrisHemedinger
Community Manager
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
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
cjohnson
Obsidian | Level 7
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
ChrisHemedinger
Community Manager
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
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
cjohnson
Obsidian | Level 7
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
cjohnson
Obsidian | Level 7
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
ChrisHemedinger
Community Manager
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
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1989 views
  • 0 likes
  • 2 in conversation