问题
I've built the code below for getting a list of SAS registered tables from metadata. It works fine but takes a long time to run due to the large volume of WorkTables (a subtype of PhysicalTable):
data work.tables (keep=uri name);
length uri name $256;
n=1;
do while(metadata_getnobj("omsobj:PhysicalTable?@Id contains '.'",n,uri)>=0);
n+1;
if substr(uri,8,9)='WorkTable' then continue;
if metadata_getattr(uri, "SASTableName", name)=0 then output;
end;
run;
Is there any way to adjust the uri so that the WorkTable type can be excluded in the metadata query itself?
Eg as follows (doesn't work):
omsobj:PhysicalTable?@Id contains '.' and @MetadataType ne 'WorkTable'
回答1:
So the following URI did the trick, although it was only 20% faster:
omsobj:PhysicalTable?@Id contains '.' and @PublicType = 'Table'
This can of course be shortened to:
omsobj:PhysicalTable?@PublicType = 'Table'
Which shaved off an extra 0.2 seconds.
来源:https://stackoverflow.com/questions/40462703/adjust-metadata-uri-to-exclude-worktable-metadata-type