Reading a flat text file in ASCII, fixed length records, fixed-width fields. One field is department name and the word "Café" appears in it. On the records where this happens, INPUT pointer jumps backwards 1 byte and therefore my @xx specs are all off for the remainder of the record and the data gets hosed.
Is there an INFILE option or parm that I can use to keep everything lined up?
thanks
Doug
Are you sure your text file is ASCII and not ANSI or UTF? A good way to check is opening the file with Notepad++ and there check in the encoding menu what it tells you.
Not sure why your pointer would be "jumping backwards" but I sure had already my fun with the "é". There is an "encoding" option available for the infile statement which you should set to the value of your source file.
Are you sure your text file is ASCII and not ANSI or UTF? A good way to check is opening the file with Notepad++ and there check in the encoding menu what it tells you.
Not sure why your pointer would be "jumping backwards" but I sure had already my fun with the "é". There is an "encoding" option available for the infile statement which you should set to the value of your source file.
To be more specific, the pointer isn't "jumping backwards". I'm trying to read the field at position 100 (@100) for example, but when there is "Café" in the preceding field, position 100 is blank and the data is actually at 101.
I always assume I'm dealing with ASCII when reading text files on a PC, and the file is sourced from USA. So I downloaded Notepad++, found the encoding was UTF-8, put that option on the INFILE, and it works fine now!
Thanks for the tip!
Doug
The encoding of the little e with accent uses obviously 2 bytes but you're only reading the first byte with ASCII (and then you get one byte "behind").
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.