【问题标题】:SAS EG : Selecting the most recent dataset from a librarySAS EG:从库中选择最新的数据集
【发布时间】:2016-09-16 18:46:06
【问题描述】:

我使用 EG V5.1。我需要选择保存在永久库中的最新数据集。我怎样才能做到这一点而不必看图书馆?

employee_2016_09_04
employee_2016_09_15
first_2016_09_04
first_2016_09_14

我需要选择任一类别的最新表格,这些表格是 SAS 数据集。我目前为每次运行代码时手动更新的日期定义了一个宏变量。任何帮助表示赞赏。谢谢

【问题讨论】:

    标签: sas sas


    【解决方案1】:

    您可以使用dictionary tables

    使用修改 (modate) 或创建列 (crdate)。

    proc sql;
        create table tables as
        select memname, modate 
        from dictionary.tables
        where libname = 'SASHELP'
        order by modate desc;
    quit;
    

    或对变量名使用排序 (memname)。

    proc sql;
        create table tables as
        select memname 
        from dictionary.tables
        where libname = 'SASHELP'
        order by memname desc;
    quit;
    

    或者同样的事情使用sashelp 视图

    data tables;
        set sashelp.vtable;
        where libname = 'SASHELP';
        keep memname modate;
    run;
    
    proc sort data=tables;
        by descending modate;
    run;
    

    【讨论】:

    • 谢谢。现在我可以找出最新的数据集。有没有一种方法可以让我不必看这张表就可以阅读观察结果?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-28
    • 1970-01-01
    相关资源
    最近更新 更多