Я использую MYSQL.В основном я пытаюсь сгенерировать набор данных на основе моего собственного определенного диапазона дат.Может кто-нибудь поделиться, как я могу сделать зацикливание как в SAS?пример:
%macro date_loop(start,end);
/*converts the dates to SAS dates*/
%let start=%sysfunc(inputn(&start,anydtdte9.));
%let end=%sysfunc(inputn(&end,anydtdte9.));
/*determines the number of months between the two dates*/
%let dif=%sysfunc(intck(month,&start,&end));
%do i=0 %to &dif;
/*advances the date i months from the start date and applys the DATE9. format*/
%let date=%sysfunc(putn(%sysfunc(intnx(month,&start,&i,b)),date9.));
%put &date;
%end;
%mend;
%date_loop(2017-01-31,2019-01-31)
Часть моего кода MySQL: st_date определяется самостоятельно.
SET @st_date = '2019-01-31'
DATE_FORMAT(@st_date,'%d/%m/%Y') as POSITION_DATE,