I'm building a utility that leverages the SAS metadata ID (or URI) of a table object. The following code works fine for getting the ID when the library uses the BASE engine:
%let mylib=SOMELIB;
data output (keep=uri dataname);
length uri $100 dataname $256;
uri='';
i=1;
do until (rc<0);
rc=metadata_getnasn("omsobj:SASLibrary?@Libref='&mylib'","Tables",i,uri);
put rc=;
prc=metadata_getattr(uri,"Name",dataname);
if rc>=0 then output;
i+1;
put i=;
end;
run;
However for other library engines (eg OLEDB, ODBC, REMOTE) SAS will store the information in different properties (eg under "UsingPackages/[my db]/Tables"). I can write conditional logic for each of the library engines I come across, but wondered if there was an easier / more generic way to get the Table ID?
The same issue occurs in reverse (if I search for the Table I still need the SASLibrary to ensure it is unique).