2

We've migrated our data warehouse and we are being asked to use SAS EG to connect to a metadata server where all our libraries are.

Is there a way to still use PC SAS to connect to those libraries ? If so, any hints on how to do this ?

I prefer using Base SAS for various reasons, one of them being that with SAS EG, if our metadata server is down (which happens a lot), then I can't authenticate my session, thus I'm screwed.

Also, most of my SAS coding doesn't require me to access that specific data warehouse so I'd rather not be tied to SAS EG.

Joe
  • 62,789
  • 6
  • 49
  • 67
Crna Krv
  • 127
  • 2
  • 11
  • 1
    The answers I see address whether it's possible to connect to warehouse from PC SAS without connecting to metadata server. I think it's also possible to connect to metadata server from PC SAS. Are you interested in that approach? – Quentin Feb 25 '16 at 20:04
  • I've had a set up like that, but our administrators had created a separate autoexec so that we could connect to the libraries but we did not connect to the meta data server. We also had EG that did connect to the metadata server. So both were installed on our desktops. – Reeza Feb 25 '16 at 23:12
  • @Quentin, yes. Any ideas how ? – Crna Krv Feb 26 '16 at 02:15

3 Answers3

3

Yes of course you can connect to a metadata defined library from PC SAS - just two statements required!

options metaserver="YourMetaserver.domain" 
            metaport=8561 /* as appropriate */     
            metauser="YourMetadataUserID"   
            metapass="YourMetadataP*ssw*rd";

libname YourLibref meta library="The library name given in metadata";

Personally I prefer to work with librefs than remember the library names so I wrote the below to assign as appropriate (you need to be connected to the metadata server first, via the options statement above)

%macro assign_lib(
    libref=  /* libref that needs to be assigned */
  );
%if %sysfunc(libref(&libref)) %then %do;
  data _null_;
    length lib_uri LibName $200;
    call missing(of _all_);
    nobj=metadata_getnobj("omsobj:SASLibrary?@Libref='&libref'",1,lib_uri);
    if nobj=1 then do;
       rc=metadata_getattr(lib_uri,"Name",LibName);
       call symputx('LIB',libname,'L');
    end;
    else if nobj>1 then do;
      putlog "ERROR: More than one library registered with libref &libref";
    end;
    else do;
      putlog "ERROR: Library &libref not found in metadata";
    end;
  run;
  libname &libref meta library="&lib";
  %if %sysfunc(libref(&libref)) %then %do;
    %put WARNING: Library &libref not assigned!;
  %end;
%end;
%else %put NOTE: Library &libref is already assigned;
%mend;

use as follows:

%assign_lib(libref=SVRLIBRF)
Allan Bowe
  • 12,306
  • 19
  • 75
  • 124
  • looked like it would work, as I see the icon for the newly assigned library appearing and I can double click the library and see all the related datasets. BUT, for some reason I have a "NOTE: Library xxxx does not exist." message and any dataset that I try to open is empty. With SAS EG, I see that these datasets aren't empty. – Crna Krv Mar 01 '16 at 20:32
  • This is likely due to an incorrect definition for that library in metadata (or permissions issues). – Allan Bowe Mar 02 '16 at 09:08
2

Mostly, this is a question for your site's Data Warehouse Administrators (the people who control access to your data warehouse). It may, or may not, be possible to connect directly to the data warehouse, depending on how it is set up, and how permissioning is done. Oftentimes the answer is no, and it's set up specifically to avoid allowing this (as that's one easy way to handle authentication).

That aside, your second point does not mean you can't use Enterprise Guide and avoid the metadata server. In Enterprise Guide, you can select which server to run code on, which should include the option for the "local server", which is your local Base SAS installation. (In fact, that's how I use Enterprise Guide 100%.) So, if the metadata server is down, or you for other reasons want to avoid connecting to it, you can simply open EG with a Local Connection profile and run code locally.

Joe
  • 62,789
  • 6
  • 49
  • 67
  • 1
    It also depends on licensing and what has been installed on their desktops. It is possible to have an EG instance that does not allow you to run local SAS. – DomPazz Feb 25 '16 at 19:07
  • @DomPazz True, but given the user is asking if he can use his local SAS installation... I make an I think reasonable assumption there. – Joe Feb 25 '16 at 19:12
  • Understand. Having been through this as a client, a 3rd party consultant, and a SAS employee, often in these cases a new SAS license has been negotiated and desktop SAS is replaced by server/EG SAS. – DomPazz Feb 25 '16 at 22:13
0

There are a couple of big IF's.

  1. If you have a license to run SAS on your desktop.

  2. If you have a license for the proper ACCESS engine on your desktop SAS.

  3. The data warehouse/data base has permissions for you to log in remotely through the ACCESS engine.

If all of those are true, then yes. If not, no.

DomPazz
  • 12,415
  • 17
  • 23