As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Registering/Deleting MetaData Tables

From sasCommunity
Jump to: navigation, search

I needed to develop a method that would allow users to register and delete metadata tables, but who did not have SAS Management Console (due to "security" issues). I didn't want to just hand them the specs for PROC METALIB, so I wrote two stored processes:


The first stored process is used to register a table that currently exists in one library (e.g., in a user's SASUSER library) to a meta library. The user must enter the table libref.dsn (&P_Table), the name of the meta library (&P_Library), and the SAS Folder name to be registered to (&P_SASFolder):

   %macro main;
   
   * Copy dsn;
   proc datasets;
       copy in = %scan(&P_Table,1,%str(.)) out = &P_Library;
       select %scan(&P_Table,2,%str(.));
   run;
   
   * Register just this dsn;
   proc metalib;
       omr (library="&P_Library");
       update_rule=(delete);
       select (%scan(&P_Table,2,%str(.)));
       FOLDER = "&P_SASFolder";
       report;
   run;
   
   %mend main;
   %main;


A separate stored process is used to delete a table (&P_Table) registered to the metadata server. It first deletes the table from the library, and then re-updates the metalibrary:

   %macro main;
   
   * Delete dsn;
   proc datasets library = %scan(&P_Table,1,%str(.));
       delete %scan(&P_Table,2,%str(.));
   run;
   
   * Update metadata;
   proc metalib;
       omr (library="%scan(&P_Table,1,%str(.))");
       update_rule=(delete);
       select (%scan(&P_Table,2,%str(.)));
       report;
   run;
   
   %mend main;
   %main;

--Sterling Paramore 00:30, 18 March 2010 (UTC)