How do I see what output options are available in my proc?

前端 未结 1 1002
半阙折子戏
半阙折子戏 2020-11-28 15:59

Running complex procs such as PROC REG or PROC GLM, there are often tables that are produced in the output window describing the results of the reg

相关标签:
1条回答
  • 2020-11-28 16:37

    In order to identify possible output datasets, SAS provides the ods trace statement. This asks SAS to write to the log the name (and some details) of each data table it writes to the output. In most cases, this can be saved to a dataset via ods output.

    For example, in the SAS example referred to in the question, you could write:

    ods trace on; 
        proc reg data=baseball;
           id name team league;
           model logSalary = no_hits no_runs no_rbi no_bb yr_major cr_hits;
        run;
    ods trace off;
    

    That would report in the log that "FitStatistics" is the name of the output object you want. Then you write:

    ods output FitStatistics=fitds;
    proc reg data=baseball;
       id name team league;
       model logSalary = no_hits no_runs no_rbi no_bb yr_major cr_hits;
    run;
    

    and it will output the fitds dataset.

    ODS Trace is only needed for the purpose of determining the name of the table of course - once you know the name of the table you need, you can simply use that name with ods output in the future.

    You also frequently can find the list of the table names in the documentation; for example, PROC REG places them here.

    ODS Output may be placed any location before the run statement (as it is a global statement); a common location is immediately before run. My personal preference is to put it before the proc as it is a global statement, but there is some disagreement with that approach.

    0 讨论(0)
提交回复
热议问题