There must be some simple SAS syntax for this ...but just can't figure it out.
I know the full metadata path and name for a metadata object (table). How can I test if this metadata object exists?
Maybe you can try the METADATA_PATHOBJ function. It returns -3 if the object is not found:
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrmeta/p1xunv8xz32p17n111eqr6edimy1.htm
Maybe you can try the METADATA_PATHOBJ function. It returns -3 if the object is not found:
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrmeta/p1xunv8xz32p17n111eqr6edimy1.htm
@LinusH I was a bit too quick to accept your post as solution.
Running below I get an rc of -2 which means "syntax error in path" even though I've copy/pasted the path directly from SMC as well as the table name.
data _null_;
length id $20;
length type $256;
proj="";
deftype="";
id="";
type="";
rc=metadata_pathobj(proj,"/Folder1/Folder 2/Data/Visual Analytics(CLASS_2)",
deftype,type,id);
put rc=;
put id=;
put type=;
run;
Not sure why that's not working given this is in the foundation repository and I'm creating this metadata table object with the same user (so not a permission issue).
....and I actually found very similar code in the template I've used as a starting point of my code. Hmmm....
It worked once I used syntax as per https://support.sas.com/kb/42/872.html
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.