【问题标题】:How to get current table name inside sas data step? [duplicate]如何在 sas 数据步骤中获取当前表名? [复制]
【发布时间】:2021-10-05 17:59:23
【问题描述】:

我需要连接一些表并创建一个带有一些标记的新列,以指示数据来自哪个表。

我有 tbl_202101、tbl_202102 ... tbl_202109。我需要加入所有的,添加一个新的列table_origin,例如,表示各自的表。

DATA FINAL_TABLE;
SET TBL_202101 - TBL_202109;

/* Here I don't know how to identify the current table */
table_origin = CASE 
WHEN *CURRENT TABLE* = TBL_202101 THEN 202101
WHEN *CURRENT TABLE* = TBL_202102 THEN 202102 
AND GO ON...

RUN;

我该怎么做?

【问题讨论】:

    标签: sas datastep


    【解决方案1】:

    设置语句选项

        INDSNAME=variable
         
        creates and names a variable that stores the name of the SAS data set
    from which the current observation is read. The stored name can be a data
    set name or a physical name. The physical name is the name by which the
    operating environment recognizes the file. 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-09
      • 1970-01-01
      • 2016-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多