If these are the only file names that begin with "A2024" then the task is easy and does not require macros. For example:
data want;
set A2024: indsname = month;
run;
If some version of MONTH is already part of each data set, you can skip the INDSNAME option.
Have you verified that all the data sets you are thinking of using have the same variables? And that the variables are all of the same type and length?
I ask because the properties of the data may limit how you "append" data. And if the variables of the same name have different lengths additional steps may be needed to prevent loss of data. We have many cases of new users assuming their data is the same and finding out when they go to combine data sets that there are problems that will prevent any sort of appending.
If your problem is as as simple as you state you may just need a single macro variable.
%let listvar = A202401 A202303 A202308; Data want; set &listvar; run;
By same location I would expect in SAS terms that you have assigned a library to point to that location. Then the listvar above would have the datasets as libref.name instead of just the name.
libname mylib "<path>"; %let listvar = mylib.A202401 mylib.A202303 mylib.A202308;
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.