I have a macro that does rolling regression. For each regression, it takes a long time so I would like to look at the LOG and know what period it is regressing. I use the function %PUT to display the period start and end. However, this displays the actual number of datetime variable without formatting. So how do I ask SAS to format and display those date variables? My codes are : /*Loop for years and months*/
%do yy = &year1 %to &year2;
%do mm = 1 %to 12;
/*Set date2 for mm-yy end point and date1 as 24 months prior*/
%let xmonths= %eval(12 * &nyear); *Sample period length in months;
%let date2=%sysfunc(mdy(&mm,1,&yy));
%let date2= %sysfunc (intnx(month, &date2, -1,end)); *Make the DATE2 last day of the month;
%let date1 = %sysfunc (intnx(month, &date2, -&xmonths+1, begin)); *set DATE1 as first (begin) day;
%let date3 = %sysfunc (intnx(month, &date2, 1, begin));
/*FYI --- INTNX quirk in SYSFUNC: do not use quotes with 'month' 'end' and 'begin'*/
/*An extra step to be sure the loop starts with a clean (empty) dataset for combining results*/
%put ................. Period: &date1. -------> &date2. .................;
... View more