[英]How to calculate the number of days of first week of the month in SAS.if we consider Saturday as first week day
[英]How to calculate month number in sas
嗨,我需要计算 sas 中假设的月份值 01jan1960 等于 1 02jan1960 等于 2
所以我需要计算 01aug2020 我使用了 intck 函数但没有输出
我只想要在 datastep 中。
SAS 将日期存储为自 1960 年以来的天数,零表示 1960 年的第一天。要在程序中表示日期,只需使用带引号的字符串后跟字母 D。该字符串需要是 DATE 信息可以解释的内容。
让我们运行一个小测试。
6 data _null_;
7 do dt=0 to 3,"01-JAN-1960"d,'01AUG2020'd;
8 put dt= +1 dt date9.;
9 end;
10 run;
dt=0 01JAN1960
dt=1 02JAN1960
dt=2 03JAN1960
dt=3 04JAN1960
dt=0 01JAN1960
dt=22128 01AUG2020
因此,'01AUG2020'd 的日期值为 22,128。
减法运算
days_interval = '01Aug2020'd - '01Jan1960'd;
或者查看未格式化的值,因为 SAS 存储日期为 01Jan1960
days_interval = '01Aug2020'd;
format days_interval 8.;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.