Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

do loop like sas

kaweng88's profile image kaweng88 posted 9 months ago in General Permalink

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;


Please login to leave a reply, or register at first.