如何将 CRSP 日期类型转换为正常日期类型 YYMMDD?

How to convert CRSP date type into normal date type YYMMDD?

我正在努力解决将 CRSP 数据集的日期类型转换为正常日期类型(例如 YYMMDD)的问题。我的 CRSP 数据集下载为 SAS 格式,但日期由 SAS 整数表示,例如 7456。

有人知道如何将 SAS 整数转换为正常的日期格式 YYMMDD 吗?我将非常感谢您的帮助!

SAS 将日期存储为天数,使用 0 表示 1960-01-01。因此,根据您使用的系统,您只需要将系统用于存储 1960 年 1 月 1 日的值增加 7,456 天。

data _null_;
  input date ;
  put date comma7. +1 date date9. +1 date yymmdd10. ;
cards;
0
7456
;


    0 01JAN1960 1960-01-01
7,456 31MAY1980 1980-05-31