SQL: 是否可以替换现有变量中的值并在相同的 SELECT 语句中将其重命名为相同的名称?

SQL: Is it possible to replace values in an existing variable and rename it to the same name in the same SELECT statement?

我想知道是否可以在 SQL 中的同一 SELECT 语句中替换现有变量中的值。

create table temp as
     select ID
            , DOB 
            , AGE
            , DISEASE_INDICATOR
            , case when DISEASE_INDICATOR = 'Y' then 1 else 0
            end as DISEASE_INDICATOR
     from my_table;
quit;

我收到的错误消息是:“警告:变量 DISEASE_INDICATOR 已存在于文件 WORK.TEMP 中”

提前致谢!

只需删除上一列:

create table temp as
     select ID, DOB, AGE,
            (case when DISEASE_INDICATOR = 'Y' then 1 else 0 end) as DISEASE_INDICATOR
     from my_table;
quit;

或者给列不同的名称:

create table temp as
     select ID, DOB, AGE,
            DISEASE_INDICATOR as DISEASE_INDICATOR_YN,
            (case when DISEASE_INDICATOR = 'Y' then 1 else 0 end) as DISEASE_INDICATOR_01
     from my_table;
quit;