8 thoughts on “SAS PROC METALIB and ODS OUTPUT”

  1. I am curious about using these output files. However when I’ve tried this on my own metadata I find that only the summary is created the other output files are not created and I receive this warning message for deltab, updttab and addtab:
    Output ‘deltab’ was not created. Make sure that the output object name, label, or path is spelled correctly. Also,
    verify that the appropriate procedure options are used to produce the requested output object. For example, verify that
    the NOPRINT option is not used.
    Do you have any idea as to what I might be doin wrong?

    here is my code:

    ods trace on;
    ods output
    factoid1=work.ml_sum /* Summary information. */
    updtab=work.ml_up /* List of tables that need to be updated in metadata. */
    addtab=work.ml_add /* List of tables that need to be added to metadata. */
    deltab=work.ml_del /* List of tables that might need to be deleted from metadata. */;

    proc metalib;
    omr (library=”library” repname=”SASApp” );
    update_rule=(delete);
    Select (list of tables I want to process );

    *noexec;
    report;
    run;

    ods output close;
    ods trace off;

    Thank you,
    Dennis

  2. Hi Dennis,

    Thanks for your question.

    That’s right, if an expected ODS object is not created then you’ll get a warning message. Proc metalib with ods output will not generate an output object if there is nothing to report for that category. i.e. when there are no tables to add, then no addtab object will be created and when there are no tables to delete the deltab object wont be created.

    If you are expecting that some ODS objects might not be generated (as you probably would) then you can suppress the warning using the NOWARN option like so:

    ods output factoid1=work.ml_sum updtab(nowarn)=work.ml_up addtab(nowarn)=work.ml_add deltab(nowarn)=work.ml_del;

    BTW I notice in the code you pasted that you had the repository name as “SASApp”. Is that your repository name or is it a typo? It looks like a SAS application server name to me, hence the question.

    Cheers
    Paul

  3. Paul,
    This is a Wonderful Post and i have used this in my Code too. Thanks for taking time to Share this with us.

    However i do notice something in both the results from my Code and your Example above .

    In the Example above the Metadata for only 1 table would have been updated but then the NOTE in the bottom of the example shows this :
    NOTE: The data set WORK.ML_UP has 4 observations and 8 variables.

    I would have expected only ONE observation corresponding the table being updated in the dataset WORK.ML_UP.

    Even when i use this method in my code i too get a different number ( ie more ) of Observations in the WORK.ML_UP dataset instead of the exact Number of tables whose metada has been updated. The number of observations i see in this dataset makes no sense to me BUT i see that except for the table names which have been updated the rest of observations have blank values in this dataset.So i guess i can delete these blank values to get the correct number of observations in this dataset.

    Are u also observing the same ?. I guess this may be a BUG but something which can fixed by deleting the blank values to get the correct Number of observations corresponding to updated tables.

  4. Thanks for your comment and question Prashant.

    Regarding the additional table rows, whilst the number of tables that would be updated might only be 1, there may be multiple changes to metadata that are required to get that single table’s metadata back in sync with the physical table. Each of those table row in ML_UP represents a single change. The rows look to be mostly blank because of the non-repeating values for the left-most columns. In my case the right-most column (Change) specifies which metadata attribute is being changed. Compare the dataset contents with the output report that is also generated and that should make it clearer. Remember that ODS OUTPUT is used to capture what would normally be printed output as SAS tables.

  5. Thanks again Paul. That explains why i see more than one record in the ML_UP table.

  6. Hi there,
    I used your code to check whether metadata is similar to the physical structure.
    I now have warnings about primary & foreign keys that can’t be updated.

    WARNING: Processing primary key table . Foreign key table was not selected, so no foreign key changes will be
    applied for it.

    I don’t even want him to do that, but how can I suppress these warnings? My job crashes because of this warning (using LSF as a schedular).

    Hope you have a solution.

    Thanx in advance!

  7. Hi Dennis,

    My guess is that perhaps you have 1 or more tables in that library that have constraints referring to tables that no longer exist in that library or refer to tables in another library. There is a SAS note that explains the latter scenario: SAS Problem Note 20776: “The METALIB procedure cannot register metadata for tables that contain foreign key integrity constraints that refer to tables in another library” http://support.sas.com/kb/20/776.html

    Cheers
    Paul

Comments are closed.