08-05-2011 08:43 AM
I am trying to process a file with records that have a 'header' with fixed layout, and a body with a variable layout. There is information in the fixed header of the offset within the record for a variable I am trying to read. For example, in the header at say position 10 there is a variable which has the offset location for say a customer name. I can read this offset easy enough, but how would I then input into a CUSTOMER variable from this offset? @OFFSET CUSTOMER $10. ?? I haven't tried this but I am doubtful it will work and hope someone else knows how to process files of this kind.
08-05-2011 09:36 AM
It will be easier for people to provide some direction if you provided a small example of what one of the files looks like. It sounds like you only need to parse the header record and then apply it to the other records.
The following thread contains some examples that might be helpful:
08-05-2011 09:46 AM
Something like this should work...
if _n_ = 1 then do;
input @10 offset ; * read the varying offset;
retain offset; * keep this value across observations;
drop offset; * don't include on output dataset;
input @offset customer $10. ; * all subsequent records;
08-10-2011 06:18 PM
you suggest ' I haven't tried this but I am doubtful it will work'
don't be doubtful - it does work
but remember to retain the 'OFFSET' variable