I have a SAS job in which I am trying to take a text delimited dataset and converting it into a regular dataset -- getting ride of the "" and ;. And lining up each column.
Following is the code I am currently using, but since it is a text delimited file, it does not line up appropriately or pull in the correct fields
@ 2 FOLDER $4.
@ 48 SERIAL $6.
@ 56 DATE $8.
@ 66 DOCNAME $20.;
IF FOLDER = 'APPL';
OPTIONS NOCENTER MISSING=' ';
DATA EMPS; SET EMPS;
PROC SORT; BY SERIAL;
FILE OUT NOPRINT NOTITLE;
PUT @1 SERIAL 6.
@8 FOLDER 4.
@12 DATE 8.
@20 DOCNAME 20.;
The data in the text delimited file looks like:
"APPL";"ASCENT1";"A1001001A06K11B20419A97524";"999999";20060516;"Matters of Impo"
"APPL";"ASCENT1";"A1001001A06K11B20421I87207";"999999";20060516;"Matters of Impo"
First add dlm=';' dsd missover to your infile statement.
dlm specifies the separator between fields.
dsd says that you character data will be in quotes.
missover will stop SAS to bother when reading pass the en of the line.
Doing this, there is still a quote at the end of the DOCNAME column which I can't figure out how to eliminate (except for some dirty compress()/subtr action afterwards). But I'm sure there are some INFILE gurus out there who knows...