Suppose I have a very large (multiple GB) binary data file, that I'm want to read into SAS (using 9.3 at the moment). I don't want to read in the entire file, but, rather, I want to read in every nth record. For simple data files (ASCII), this can be done fairly easily using #. For example, suppose I have some file called test.dat containin g 3 data files/columns (x,y and z). The following reads in every 5th record: filename in 'c:\users\userDesktop\test.dat';
data hold; infile in;
input #5 x y z;
run; Works fine. But, for some reason, if test.dat is a binary file, this approach doesn't seem to work. To read in the particular binary data file, I use something like the following input syntax: input buffer1 RB4. Chain1 RB8. Chain2 RB8.; Works fine. However, input #5 buffer1 RB4. Chain1 RB8. Chain2 RB8.; doesn't work as expected (or really, at all...). I know I could probably do this using 2 steps: (i) read in the full binary file, and then (ii) use some 'tricks' with subsetting the data to keep only every nth record, but the original file is so large I'm trying to avoid having to read the entire thin in in the first place. Suggestions/pointers to the obvious are welcomed.
... View more