Hi all,
I hope that somebody can help me to find a solution for my problem. I hope it is not complicated but somehow I'm just not able to solve it:
There are some Reports that are created with stored processes and stored on metaserver under Reports -> Special
We have created the permission-concept that gives some users possibility to open this Folder, others don't even see that it exists.
Now I would like to create a link from one Stored Process to those but show then (links) only if the user can see the Folder.
there are many ways to open directory, count files, check if the file can be opened etc. However, the problem is that all examples are made on windows (local) server. I have a unix server and I don't know where those files are...
I haven't found a way to check if a folder or a directory or a file inside it exists using only meta-path.
is there a way?
Thanks for sharing ideas.
Hi,
I'm assuming you just want to scan a metadata folder to see whether or not it contains stored processes? The following example is more generic but creates a single table which lists all stored processes found in metadata (across all folders). You can adjust the code or simply filter for the folder you are after. As you mentioned the final list of reports is dependent on the permissions of the given user (if you are planning to run this as part of a Stored Process you don't need to have the meta* options):
options metaserver="localhost"
metaport=8561
metauser="myuser"
metapass="mypass"
metarepository="Foundation";data reports;
length label $200 path $500 tmp $500;
length uri $256 asnuri $256;
nobj=1;
n=1;keep label path;
do while(nobj >= 0);
nobj=metadata_getnobj("omsobj:ClassifierMap?@Id contains '.' and @PublicType eq 'StoredProcess'",n,uri);
rc=metadata_getattr(uri,"Name",label);
rc=metadata_getnasn(uri,"Trees",1,asnuri);
arc=metadata_getattr(asnuri,"Name",path);/* walk through all the trees on this ClassifierMap object. */
rc = 1;
do while(rc>0);
rc=metadata_getnasn(asnuri,"ParentTree",1,asnuri);
arc=metadata_getattr(asnuri,"Name",tmp);
if (rc>0) then path = trim(tmp) || "/" || trim(path);
end;/* building the stored process full qualified path*/
path = "/" || trim(path) || "/" || trim(label) || "(StoredProcess)";
n=n+1;
output;
end;
run;
Reading your question it is a SAS-metadata question.
That has nothing to do with Windows or Unix Specifics although the word folder is used.
It is that more than one thing can share the same name. You are ajuvaba, is that name solely used for you?
I do not get the intention of your question, or what you ar trying to solve.
With normal usage the user only can select the thing he can see.
Some idea for reporting:
Do A export metadata from the path with the user having limitation (creating a package).
Use the log of that process as it generates a listing of all it could see.
You could build it all yourself on low-level interfaces. SAS(R) 9.4 Open Metadata Interface: Reference and Usage
or with datastep interface SAS(R) 9.4 Language Interfaces to Metadata . I would classify this as to diificult.
Hi,
I'm assuming you just want to scan a metadata folder to see whether or not it contains stored processes? The following example is more generic but creates a single table which lists all stored processes found in metadata (across all folders). You can adjust the code or simply filter for the folder you are after. As you mentioned the final list of reports is dependent on the permissions of the given user (if you are planning to run this as part of a Stored Process you don't need to have the meta* options):
options metaserver="localhost"
metaport=8561
metauser="myuser"
metapass="mypass"
metarepository="Foundation";data reports;
length label $200 path $500 tmp $500;
length uri $256 asnuri $256;
nobj=1;
n=1;keep label path;
do while(nobj >= 0);
nobj=metadata_getnobj("omsobj:ClassifierMap?@Id contains '.' and @PublicType eq 'StoredProcess'",n,uri);
rc=metadata_getattr(uri,"Name",label);
rc=metadata_getnasn(uri,"Trees",1,asnuri);
arc=metadata_getattr(asnuri,"Name",path);/* walk through all the trees on this ClassifierMap object. */
rc = 1;
do while(rc>0);
rc=metadata_getnasn(asnuri,"ParentTree",1,asnuri);
arc=metadata_getattr(asnuri,"Name",tmp);
if (rc>0) then path = trim(tmp) || "/" || trim(path);
end;/* building the stored process full qualified path*/
path = "/" || trim(path) || "/" || trim(label) || "(StoredProcess)";
n=n+1;
output;
end;
run;
thank you very much for quick answers. the example code is exactly what I need. now I understand what I have to do - walk through the metadata. I already tried it and it gives me exactly what I need.
Fantastic.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.