Menu

SASUnit Error: Display Actual Table in html report with format

Anonymous
2021-01-14
2021-01-15
  • Anonymous

    Anonymous - 2021-01-14

    Hello,

    Thank you for providing such a fantastic tool for UnitTesting. I am very
    confident that it will substantially support our goal to validate
    standard macros.
    Currently I try to get the SASUnit toolbox to run in batch mode on a
    Linus X64 Server. The SASUnit script will be started via a bash without
    using an XDisplay.

    I implemented first tests that asserts the correctness of an (output)
    dataset with formats (using %assertColumns).
    This functions well. The tests reconcile the correctness of actual and
    expected datasets.

    However, an ERROR occurs during the preparation of the html report -
    when the actual dataset should be incorporated in the report
    (_RENDER_ASSERTCOLUMNSREP).
    SASUnit cannot find the attached format that is used in the dataset.

    LOG-Message:-----------------------------------------------------------------------------------------------------------------------------------------------
    MPRINT(REPORTSASUNIT._REPORTDETAILHTML._RENDER_ASSERTCOLUMNSREP): TITLE
    "SAS table actually created";

    MPRINT(REPORTSASUNIT._REPORTDETAILHTML._RENDER_ASSERTCOLUMNSREP): PROC
    PRINT DATA=_acLib._columns_act;
    MPRINT(REPORTSASUNIT._REPORTDETAILHTML._RENDER_ASSERTCOLUMNSREP): RUN;

    ERROR: Format TRTA_F not found or couldn't be loaded for variable trt01aN.
    NOTE: The SAS System stopped processing this step because of errors.
    NOTE: PROCEDURE PRINT used (Total process time):
          real time           0.00 seconds
          cpu time            0.00 seconds


    In the *test.sas program, I used options fmtsearch to add the search
    path of the used format catalogs.

    What can I do to let SASUnit find the format catalog for preparing the
    html report?
    Do you need some more information on this issue?

    Best regards
    Stefanie

     
  • Klaus Landwich

    Klaus Landwich - 2021-01-14

    Hi Stefanie,

    that makes perfect sense to me. In your *test.sas programs you need the fmtsearch for your data processing.

    However HTML reporting is done in the overall SAS session that uses run_all.sas. So you need to specify the fmtsearch in run_all.sas too.
    That should solve the problem.

    Second option would be to specficy "options nofmterr;" in run_all.sas. This will suppress the ERROR when the format is not found. The HTML report will the show the unformatted value. The comparison of the data sets will not be affected if the format is not present, because formats are only used to display values.

    Regards
    Klaus

     
  • Anonymous

    Anonymous - 2021-01-15

    Hello Klaus,

    thank you for your quick response! This solved my problem!
    Additional to the fmtsearch, I had to re-specify the libraries themselves.
    I added the following code right before %reportSASUnit(...)

    libname  formatsT    "/path/to/formatlibTest"; *Format lib for testing;
    libname  formatsR    "/path/to/formatlibRef"; *Format lib for reference;
    options fmtsearch   = (formatsR.fmtref formatsT.fmttest);  
    %reportSASUnit(...)
    

    Thank you!
    Stefanie

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.