To replace the 3200 with the value stored in the macro variable &xbarmac , you can use the following approach. This involves dynamically constructing the array declaration with the macro variable: Calculate the Maximum Number and Store in a Macro Variable: You've already done this step correctly: data _null_; set have; call symput("xbarmac", max_number); run; %put &xbarmac; Use the Macro Variable in the Array Declaration: You can now use the macro variable &xbarmac in the array declaration: data want(drop=day366-day&xbarmac); set have; array daydummy(*) day1-day&xbarmac; /* Your code logic here */ run; Explanation: day366-day&xbarmac : This will dynamically drop the range of variables from day366 to day3562 (if &xbarmac is 3562). array daydummy(*) day1-day&xbarmac; : This will create an array daydummy that includes all variables from day1 to day3562 .
... View more