79618363

Date: 2025-05-12 17:31:50
Score: 1
Natty:
Report link

Nice solution. (no new answer. I modified the original question)?

%macro create_table();
PROC SQL;
    CREATE TABLE TEST AS
    SELECT DATE, NAME,
           %DO i = 1 %to 3;
             0 AS A&i.,
           %END;
           1 as B
    FROM SOURCE;
QUIT;

%mend create_table;

%create_table();

Can this be expanded to allow a let evaluation within the loop (or something else that will hold a new macro-var)?

I have a large number of columns that in my case look over 13qtr of data, and within each bucket of 40 or so columns 13(40) there are a good number that look back for year ago data.

Thus I need something like:

let iPY = %eval(&i. +4)

but would love to avoid the +4 calc for each needed column in a qtr.

Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: KMJ