Using only CSPro there is no simple way to split a data file into several parts. Someone asked me: “How would I split a file with 300 cases into six files, each with 50 cases?” It is possible to do this by writing a recursive batch program. This is not a particularly efficient way to split a file into parts, but it works fine for data files that are not so large. This code is probably not worth using if your data file contains more than a million cases.
What I do here is use the skip case statement to selectively write out cases. The first run of the program, I do nothing but create a PFF that calls the program again with the starting position. Then that program runs, writing out certain cases and skipping others, and then calls the program again, with a new starting position. This continues until the whole file has been processed. In the above example, the program would be run seven times, once to initialize the PFF, and then six times for each block of 50 cases. See the code below:
You can use this code almost exactly as is, with the following modifications:
1) Modify the numeric numCasesPerFile from 50 to your liking.
2) Replace “CEN2000″ with the name of your dictionary. (There are two places where this appears.)
3) Replace “DICTIONARY_FF” with the name of your top-level batch PROC. (It will end with _FF.)
4) Replace “QUEST” with the name of your dictionary’s first level.
See here for an example of this application using the Popstan dictionary.