如何格式化DATE9。日期至2010年月日。在我的select语句中?
PROC SQL;
CREATE TABLE TEST AS
SELECT BIRTH_DT
FROM CUSTOMER
QUIT;
我试过了:
PROC SQL;
CREATE TABLE TEST AS
SELECT BIRTH_DT FORMAT=DDMMYYd10.
FROM CUSTOMER
QUIT;
也尝试过:
PROC SQL;
CREATE TABLE TEST AS
SELECT DATEPART(BIRTH_DT) FORMAT=DDMMYYd10. AS BIRTH_DT
FROM CUSTOMER
QUIT;
但这引发了一个错误。
电流输出为28MAY1960,我需要28-05-1960
由于在from
语句后缺少分号;
,因此出现错误。此外,不需要datepart
功能。
data have;
dt_birth = '28MAY1960'd;
format dt_birth date9.;
run;
proc sql;
create table want as
select dt_birth format=ddmmyyd10.
from have;
quit;
28-05-1960