I am trying to automate a model-creation process in SAS Enterprise Miner, meaning I can enter a variable as "ABC", click run and it will query appropriate data, build the models, and the final step of the flow is to register the new model on the Metadata Server by name. Let's call it "Model ABC".
This process works well, but the problem is that if I run this flow again, a new "Model ABC" is registered to the Metadata Server, in addition to the previously-created "Model ABC"s. So, if I look at the Metadata Server using the Management Console, I can see both "Model ABC" objects. SAS doesn't overwrite registered models even if they are identically-named. If I right-click on their properties, both models have identical properties with the exception of:
ModelKey
MetadataUpdated
MetadataCreated
Id
This model-creation flow will be run frequently going forward for a wide range of input values (in addition to "ABC"), so I would like to avoid a massive builduip of identically-named models by deleting (via SAS Code node?) all models with name="Model ABC" from the Metadata Server prior to registering the model via the Register Model node.
I know that models can programmatically be registered to the server via this macro:
SAS Help Center: %AA_Model_Register Autocall Macro
But the only options I have been able to find for deleting a registered model is via the SAS EM or Management Console GUI:
SAS Help Center: SAS Enterprise Miner Model Package Registration
Does anyone know of a way to programmatically delete models from the Metadata Server?
You could use the DATA step functions for reading and writing SAS metadata, but you would have to unpick the metadata data model to find and then delete the appropriate metadata. Please be aware that the possibility of corrupting your metadata repository is high when trialling updates. It is good practice to frequently take metadata backups and restore from these if you have problems.
You could use the DATA step functions for reading and writing SAS metadata, but you would have to unpick the metadata data model to find and then delete the appropriate metadata. Please be aware that the possibility of corrupting your metadata repository is high when trialling updates. It is good practice to frequently take metadata backups and restore from these if you have problems.
The Metadata Browser (invoke with the metabrowse command) in the SAS Windowing Environment is particularly useful for navigating the data structures:
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.