Before you can create a macro program, you need to create a program that works manually.
Have you already created it? If you have a program, we can advise you on how to make a macro.
Also, is XXXX a sequential number?
This can be done by recording the numbers in an external file or permanent data set.
Each time you run the program, you can read the number and overwrite it with +1.
For example, the following program will store a sequential number starting from 0001 in the macro variable "XXXX" every time it is executed.
%if %sysfunc(exist(lib.covid))=0 %then %do;
data lib.covid;
cnt=0;
run;
%end;
data lib.covid;
set lib.covid;
cnt=cnt+1;
call symputx('XXXX',put(cnt,z4.));
run;
The last step is to execute the program in batches.
If you are using Windows, you can register the following command in the task scheduler.
"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -sysin "C:\temp\yourprogram.sas"
-sysin is the command to batch submit.