tags:

views:

166

answers:

1

We currently use SAS to import a binary file and run queries on its data. To do this we use the techniques shown on the SAS website.

As an example, this is how we read the data:

data work.binary_data; 
infile "&ifName" lrecl=8 recfm=f;
input @1 a PIB1.
      @2 b PIB1.
      @3 c PIB1.
      @4 d PIB1.
      @5 e PIB1.
      @6 f PIB1.
      @7 g PIB1.
      @8 h PIB1.
run;

We need to send a dataset to a client for them to manipulate in SAS. Then they will send it back, and I need to convert back to the binary format needed by an in-house program. The size of the dataset will probably be over 10GB, so I'm not sure about converting to a text file first, and then just writing to binary from the text file (using c++ or something)

Does anyone know how to use SAS to write to a binary format, meaning, the same format of the file we originally read in?

+4  A: 

I no longer have access to SAS to test but I believe you can just reverse your logic above:

data _null_; 
  set data; 
  file 'c:\fileout.dat'; 
  put @1 a PIB1. 
      @2 b PIB1.
      @3 c PIB1.
      @4 d PIB1.
      @5 e PIB1.
      @6 f PIB1.
      @7 g PIB1.
      @8 h PIB1.
  ;
run;

Where PIB1 represents your binary format.

Mark
this works. thanks!
@anon: if you could please "accept" the answer (click the check-mark), I'd appreciate the reputation points.
Mark