First of all, I beg your pardon for the lack of my technical english. I'll try to make my self clear with some images.
I'm trying to import a text file "as is" to SAS. It looks like this:
In text:
YPJC200,FG;00899;Pesos;0;3500;EDENOR S.A. "B" 1 VOTO
TRAD15.9FF;00902;Pesos;0;3000;EDENOR S.A. "B" 1 VOTO
It's a text file delimited with semicolon ";" but in addition it has:
- Some names has dot "." in it (eg: TRAD15.9FF)
- Some names has comma "," in it (eg: YPJC200,FG)
- Column description has doble quotes
Of course I'm getting errors or column displacements.
As I said before, I want to import the full file "as is" in one column, replace the three first lines (that are wrong headers), replace with correct ones in one line, and export to text file again. So I need to get the same file with headers changed.
I'm using this code after trying other things:
DATA WORK.WANT;
INFILE '\\server\Interfaces\position.txt'
DSD LRECL = 32767 MISSOVER DLM = '|';
INFORMAT CAMPO $1500.;
INPUT CAMPO $;
IF _N_ >= 6;
RUN;
With "INFORMAT CAMPO $1500.;" I'm loading the file in just one column.
I'm using " DLM = '|' " to avoid delimiters. I can't set any delimiter other than this because my file has all of them (; . , ) except of course the pipe. If avoid the "DLM" option it assumes comma delimiter, so it's unuseful to.
But now I have the problem with double quotes.
I'm getting double quotes everywhere like this:
"YPJC200,FG;00899;Pesos;0;3500;EDENOR S.A. ""B"" 1 VOTO"
"TRAD15.9FF;00902;Pesos;0;3000;EDENOR S.A. ""B"" 1 VOTO"
So, the direct question is: How can I import the file exactly as it is, line by line, char by char, in the simplest way?
Thanks in advance