I'm using SAS Enterprise Guide 5.1 (32-bit)
When I try to run these two lines of code in VBScript:
Set Application = WScript.CreateObject("SASEGObjectModel.Application.5.1")
WScript.Echo Application.Name & ", Version: " & Application.Version
I receive the error below. Is there another line of code that I need to add or do I need to specify the path of EG 5.1?
Error: could not locate automation class named "SASEGObjectModel.Application.5.1".
Code: 80020009
Source: WScript.Createobject
Thank you.
I'm not an expert on VBScript, but when you use the File | Schedule project menu option in EG, it creates a VBScript file to run the project. When I did that on my PC, the equivalent line to what is giving you a problem is
Set app = CreateObject("SASEGObjectModel.Application.5.1")
Could your having WScript in front of CreateObject be causing the problem?
Tom
If you have 32-bit EG but a 64-bit Windows, make sure you're running the correct CSCRIPT.exe. See the notes at:
Using SAS Enterprise Guide to run programs in batch - The SAS Dummy
Chris
Chris,
Thank you for the link. Lots of good info.
With other vbscripts I am able to run them by double-clicking on the vbs file.
Is this possible with the code in the link you sent or do you have to use command line to run the vbscript code?
Thank you.
The default action for a VBS file on your 64-bit machine is probably to run the 64-bit version of WSCRIPT. That won't work if you are trying to automate 32-bit EG, because the required entries are not present in the 64-bit region of the Windows registry.
So, long story made short, best to run the 32-bit version of WSCRIPT or CSCRIPT. I like CSCRIPT because it puts output to the console instead of popping up windows that might hang your process.
Chris
Hi Chris,
I'm testing automation on SAS EG7.1 {precisely, 7.11 HF2 (7.100.1.2785) (32-bit)} using a Windows 7, 32-bit machine, and SAS EG is also 32-bit. So I only have the 32-bit version of cscript.exe.
I am getting a similar error as the one from 3 years ago above - Could not locate automation class named "SASEGObjectModel.Application.7.1"
Dim Application
Set Application = WScript.CreateObject("SASEGObjectModel.Application.7.1")
WScript.Echo Application.Name & ", Version: " & Application.Version
Please advise. Thanks in advance!
You might need to register the EG automation object model. Run this from a command prompt:
c:\Windows\Microsoft.NET\Framework\v4.0.30319\rega
Sample output:
Microsoft .NET Framework Assembly Registration Utility version 4.0.30319.18408 for Microsoft .NET Framework version 4.0.30319.18408 Copyright (C) Microsoft Corporation. All rights reserved. Types registered successfully
Then try your script.
Brilliant! I couldn't find the dll there, but I did find it elsewhere. Pretty much working now, except that it prompts me to login to the SAS server. I can probably figure that one out 🙂
Much appreciated...
Hi Chris,
I use EG 7.11(64 bit) scheduling on Windows 10(64 bit).
I follow your instruction ( Using SAS Enterprise Guide to run programs in batch - The SAS Dummy) and do more as you mention.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm /codebase "c:\Program Files\SASHome\SASEnterpriseGuide\7.1\sasegscripting.dll"
But Scheduler can not invoke vbs which get from EG , right now.
Could you mind to suggest how to fix?
I'd start by verifying that you can use automation from a VBS script.
Here's a simple script that you can save into a local VBS file -- for example, testEg.vbs:
' force declaration of variables in VB Script Option Explicit Dim Application ' Create a new SAS Enterprise Guide automation session Set Application = WScript.CreateObject("SASEGObjectModel.Application.7.1") WScript.Echo Application.Name & ", Version: " & Application.Version Application.Quit
I know we've touched on this, but make sure you're running the proper version of the scripting engine for your 64-bit SAS Enterprise Guide:
%windir%\system32\cscript.exe c:\projects\testEg.vbs
The output should be something like:
C:\Projects>%windir%\system32\cscript c:\projects\testEg.vbs Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. Enterprise Guide, Version: 7.100.2.0
If that works, but the scheduler doesn't, then you'll need to dig into why the Windows Task Scheduler isn't launching your process at the appointed time. The cause is probably not related to SAS Enterprise Guide; you could run some independent tests of the scheduler to see what's going on.
Thank you very much Chris,
The problem is on Windows Task Scheduler
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.
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.