How to read raw data with more than one delimiters in SAS?

sas
delimiter

#1

Hi,

I have raw data set in below format with two different delimiters (^, ; ).

Code;Product^Sales 
A001;XYZ^1234
A002^ABCDEF;7890 
A004;GHIJ^5678  

Now I want to read the data into SAS as below table

Code  Product      Sales
A001    XYZ         1234
A002   ABCDEF       7890
A004   GHIJ         5678

Can you please help me to create SAS data set?

Thx,
Steve


#2

@Steve

This works…first import the file from outside thru infile option and dlm option can have as many as delimiters.

data s;
infile “C:\Users\steve\Desktop\steve.txt” dlm="; ^";
input Code$ Product$ Sales;
run;

Hope got the answer.