BookmarkSubscribeRSS Feed
Josh
Calcite | Level 5

I'm looking at using Access as an office automation tool for managing regular reports, Access not being used to hold transaction data but data to do with the reports themselves. We use it to log and manage the requests for data and reports coming into the area.

We run SAS EG 4.1 still (along with a host of other studff compared with which 4.1 is a spring chicken) with SAS on a Unix box. Some of the directories there are mapped to the Windows LAN so the idea as a first stage semi-automation is in the first instance for the Access application to write a parameter text file from which the SAS program can read the parameters and populate its macro variables before getting to the meat of the SAS. It works well and is pretty simple but we still need to open the SAS code in SAS EG, submit the job, wait for it to finish and then exit from SAS.

We have the MS Office Add-in for Office and from Excel I can read the SAS tables on the server in Excel etc but   when I try to run sample code such as Chris's
Script.JPG

it bombs out on the CreateObject line with an ActiveX error, with 4.1 or just 4 as the version number making no difference.

I've seen various specifications regarding what references one must configure to invoke a SAS.

This one is about the minimum but copying what it specifies makes no difference

References.JPG

Using ActiveX2.8 doesn't help and going in and selecting all the SAS the SAS references that dialog box offers does not help either, i.e. as per this example

ReferencesFull.JPG

Any pointers to the missing link would be greatly appreciated.


Script.JPG
3 REPLIES 3
ChrisHemedinger
Community Manager

In EG 4.1, the automation model is a bit different. The complete reference information is at:

http://support.sas.com/documentation/onlinedoc/guide/SASEGScripting41.zip

(There is a CHM file in the ZIP archive.  Extract it, then right-click, select Properties, and "unblock" it - else you won't be able to view the content...)

Here is an example VB Script:

Dim prjName
Dim prjObject
Dim app

prjName = "C:\EG 4.1 projects\mailinghtml.egp"    'Project Name
Set app = CreateObject("SASEGObjectModel.Application.4")
Set prjObject = app.Open(prjName,"")
prjObject.Run
' Save the new project results
prjObject.Save
prjObject.Close
app.Quit

First try to create a standalone VBS file and confirm that it runs with cscript.exe or wscript.exe.  If it does, then the equivalent script in VBA should work as well.

Chris

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Josh
Calcite | Level 5

VBS first was a good suggestion as the error still occurred with "SASEGObjectModel.Application.4" but the dialog was a bit more informative: Error code 800A01AD. Googling that lead me to searching the registry (its Windows XP Professional at work) and there is no occurrence of "SASEG", let alone that string followed by anything else. There are a few entries commencing with "SAS.EG*" and "SASObjectManager" though. Is there a DLL which needs to be on the machine to support the object model? If there is but it is not there that would be indicative of the need to look elsewhere, or just manually run SASEG and click on the run icon.

ChrisHemedinger
Community Manager

You might try to remedy that issue with this note:

http://support.sas.com/kb/34/194.html

Chris

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1865 views
  • 0 likes
  • 2 in conversation