Hello all, new user to MySQL here. Previously with SAS one can generate data by looping a date range, can MySQL do the same?
Appreciate everyones help!
if in SAS will be as follows:
%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(01jun2008,01sep2009)