I have a dataset where I need to separate the cases into several different files. currently I am running:
DATASET COPY DATA1 WINDOW = FRONT.
... (repeats) ...
DATASET COPY DATA25 WINDOW = FRONT.
after it makes 25 copies, I use a bunch of select if commands on each one to pick only the cases I want, and save them as DATA1, through DATA25.
What I want to do is set up some kind of macro or loop so I can say:
LET %X = 1 to 25
loop
DATASET COPY DATA'%X' WINDOW = FRONT.
end loop
Instead of needing 25 lines of near identical syntax. This is just a very simple use case, but I am hoping I can branch out from there and do a whole bunch of other things using this kind of syntax, such as opening multiple files where I can put in a wildcard for the part for the filename that changes, or using a wildcard so I can open 'sheet 1' of and excel, and then repeat for sheets 2 to 10. Is this something I can do with SPSS? Do I need a Python or R extension? Everything I have seen thus far only lets you loop through running a set of commands on a range of variables.