11-30-2012 01:26 PM
I wanted to try running some Base SAS code in SAS EG, but haven't figured out a code-based way to assign a LIBNAME to my OLE DB in EG like I can in Base SAS (EG 4.3). If I submit my usual
LIBNAME sqlsrv oledb init_string="Provider=<x>;
Integrated Security=<x>;Persist Security Info=<x>;
Initial Catalog=<x>;Data Source=<x>" schema=dbo;
code then EG cannot assign a LIBNAME ("Error trying to establish connection: Unable to initialize (CoInitializeEx)". I know I can access the data files using Open -> OLEDB, but I'd really like some code I can run rather than having to do the point and click (and type) method every time (no background code is generated by EG using the OPEN->OLEDB process).
12-01-2012 10:16 AM
I suspect the issue is the SAS server that you are using. When you use SAS with Display Manager (what you call Base SAS), the SAS code is running on your PC. When you use EG, you may be using a different machine (called a SAS server) to run your code. Because of that, the OLE connection information that is on your machine won't be available.
First, confirm that this is the case. At the top of your program window, you should see a "Selected Server:" dropbox. If the selection is "Local", you are using your computer, and the problem is something else, which we'll try to figure out. But if the selection is anything else, your code is being submitted to a remote server, and you'll have to either use the OLE connection that exists on that server, or get the administrator of the server to set one up.
I can assure you that what you are trying to do is possible. I've done it a bunch to a variety of databases.
12-03-2012 12:22 PM
It looks like I'm successfully connected to the Local server per the left hand task pane, so it's the "something else" that we're looking for.
Although awkward, I wondered if I couldn't just make a project template with the link to the OLEDB source already started, and then I can base future projects on that? Hopefully there's something more elegant than that.
12-03-2012 03:02 PM
My advice is to get your connection problem resolved; at this point, I would put in a case to SAS Technical Support. I've had to go through a number of these over the years, and they're very good. I'm sure it should work the way you want it to, so why bother with workarounds?