我需要在 SAS 中创建一个增量表。这个表包含了该月的第一天和最后一天到今天(每个月都需要执行)。看起来像这样
First day month Final month day
01/01/2019 31/01/2019
01/02/2019 28/02/2019
01/03/2019 31/03/2019
01/04/2019 30/04/2019
01/05/2019 31/05/2019
01/06/2019 30/06/2019
01/07/2019 31/07/2019
01/08/2019 31/08/2019
01/09/2019 30/09/2019
01/10/2019 31/10/2019
01/11/2019 30/11/2019
01/12/2019 31/12/2019
01/01/2020 31/01/2020
01/02/2020 29/02/2020
01/03/2020 31/03/2020
01/04/2020 30/04/2020
01/05/2020 31/05/2020
01/06/2020 30/06/2020
01/07/2020 31/07/2020
01/08/2020 31/08/2020
01/09/2020 30/09/2020
01/10/2020 31/10/2020
谢谢
最佳答案
试试这个
data want;
first = '01jan2019'd;
do while (1);
last = intnx('month', first, 0, 'e');
if last > today() then leave;
output;
first = last + 1;
end;
format first last ddmmyy10.;
run;
关于sql - SAS - 创建增量表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64715423/