I don't think the FORMAT statement accepts an array reference. Remove the FORMAT statement from the loop, and just code:
format Assign_date1-Assign_date50 date9.;
FORMAT statements want the name(s) of the VARIABLES. I cannot take an indirect reference to a variable since it it is not executable. It just defines what format to attach to the vairable.
data test;
set dataset ;
array assign_date [50] ;
array new_date [50] ;
format new_date1-new_date50 date9.;
do I =1 to 50;
new_date[i] = input(assign_date[i] , yymmdd10.);
end;
drop I;
run;
Format statement does not recognize array references.
However you can use a single format statement:
format new_date: date9.;
anywhere in the data step.
The colon is a list indicator and says "use all the variable names that start with New_date".
You can simplify your code a little bit by using:
Array new_date(50);
That will create variables named New_date1 through New_date50 and you use New_date[i] .
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.