1

I have a situation here where I need the User ID of the SAS Metadata Libraries. I do not want to list out the users who access the Metadata. So, Fetch user id from SAS metadata server is not the solution for my query.

Please help

Community
  • 1
  • 1
Sakthi
  • 45
  • 6
  • 1
    So.. what is your query? The 'User ID of the Library' does not make sense.. Do you mean which users / groups can ACCESS that library? – Allan Bowe Dec 12 '13 at 12:25
  • No, I mean the authentication credentials used for accessing the library. Or even the server details like server name would help. I have found the way to populate the library schema details. Along with that I want to list out the server names also. – Sakthi Dec 17 '13 at 08:42
  • You can find the server details of a library in SAS Management Console. Right click on the library name and choose properties. – Sakthi Dec 17 '13 at 08:43
  • What is it that you are actually trying to achieve? The authentication details needed will vary according to the type of library you are configuring, and the security model in use (eg IWA..) – Allan Bowe Dec 17 '13 at 12:25

1 Answers1

0

SAS code to obtain the credentials (from metadata) for an ODBC library engine might look like the following:

%let libref=MYLIB;
/* get liburi */
data _null_;
  length lib_uri $256;
  call missing (of _all_);
  /* get URI for the particular library */
  rc=metadata_getnobj("omsobj:SASLibrary?@Libref ='&libref'",1,lib_uri);
  call symputx("liburi",lib_uri,'l');
run;
/* query for credentials */
data _null_;
  length connx_uri conprop_uri value datasource up_uri schema $256.;
  call missing (of _all_);
  /* get source connection ID */
  rc=metadata_getnasn("&liburi",'LibraryConnection',1,connx_uri);
  /* get connection properties */
  i=0;
  do until (rc2<0);
    i+1;
    rc2=metadata_getnasn(connx_uri,'Properties',i,conprop_uri);
    rc3=metadata_getattr(conprop_uri,'Name',value);
    if value='Connection.ODBC.Property.DATASRC.Name.xmlKey.txt' then do;
       rc4=metadata_getattr(conprop_uri,'DefaultValue',datasource);
       rc2=-1;
    end;
  end;
  /* get SCHEMA */
  rc6=metadata_getnasn("&liburi",'UsingPackages',1,up_uri);
  rc7=metadata_getattr(up_uri,'SchemaName',schema);
  call symputx('SQL_schema',schema,'l');
  call symputx('SQL_dsn',datasource,'l');
run;

libname &libref ODBC DATASRC=&sql_dsn SCHEMA=&sql_schema;

A macro which will generate a libname statement for other library types is available here.

Allan Bowe
  • 12,306
  • 19
  • 75
  • 124