Hi! I have a macro iteration loop where I make x number of columns in a table (the table is exported to Excel/csv).. It works, but I want to have variable dates in the column headings. Now the column names are: Periode_1 Periode_2 Periode_x Data Data Data I want them to be (example): Periode: 01.01.2011 - 31.01.2011 Periode: 01.02.2011-28.02.2011 Periode:x - Data Data Data I use the INTNX function in the If Then loop, and tried to use the same function (with some combinations) as a header name but no luck. Any ideas? 🙂 -------------------------------------------------------------- My code looks something like this: data TableOut; set TableIn; %macro Report(x, y); %do Next=&x %to &y; %let StartDate = '01MAR2011'd; %let EndDate = '29FEB2012'd; %let ColName = Periode_&Next; if Value = 0 then &&ColName = 0; else if (StartDate >= intnx('Month', &StartDate, -&Next, 'Same') and StartDate <= intnx('Month', &EndDate, -&Next, 'Same') and EndDate >= intnx('Month', &EndDate, -&Next, 'Same')) then &&ColName = (Value/(EndDate-StartDate)) * (intnx('Month', &EndDate, -&Next, 'Same') - StartDate); else if (StartDate <= intnx('Month', &StartDate, -&Next, 'Same') and EndDate <= intnx('Month', &EndDate, -&Next, 'Same') and EndDate >= intnx('Month', &StartDate, -&Next, 'Same')) then &&ColName = (Value/(EndDate-StartDate)) * (EndDate - intnx('Month', &StartDate, -&Next, 'Same')); else if (StartDate <= intnx('Month', &StartDate, -&Next, 'Same') and EndDate >= intnx('Month', &EndDate, -&Next, 'Same')) then &&ColName = (Value/(EndDate-StartDate)) * (intnx('Month', &EndDate, -&Next, 'Same') - intnx('Month', &StartDate, -&Next, 'Same')); else if (StartDate >= intnx('Month', &StartDate, -&Next, 'Same') and StartDate <= intnx('Month', &EndDate, -&Next, 'Same') and EndDate >= intnx('Month', &StartDate, -&Next, 'Same') and EndDate <= intnx('Month', &EndDate, -&Next, 'Same')) then &&ColName = Value; else &&ColName = 0; %end; %mend Report; %Report(0,6); run; I want the ColName to be: Periode_01MAR2011-29FEB2012 insted of Periode_0
... View more