When replacing commas with tabs, consider,
protected embedded commas. For Example:-
First some sample data including an embedded comma, properly protected..[pre]DATA _null_ ;
input ;
file "your_file" ;
_infile_ = trim( _infile_ );
put _infile_ ;
list;cards4 ;
a,b,c,d,
1,"AB,c",3,";",5
,2,,4,
email,"Goodnight, J;Thompson, Samuel B.",3,4,5
1,,3,,5
;;;;[/pre] Next, derive the number of column headers. Which I would hope is an adequate indicator for the file[pre]data _null_ ;
infile "your_file" dsd dlm=',' lrecl=10000 col=c length=l ;
do col=1 by 1 until( c > l ) ;
input cname :$40. @@ ;
end ;
put "INFO: there are " col " columns" ;
call symputx( 'n_cols', col ) ;
stop ;
run ; [/pre] Finally ready to read, sensitive to commas embedded and protected among data values[pre]data _null_ ;
infile "your_file" dsd dlm=',' lrecl=100000 truncover;
file "your_file2" dsd dlm='09'x lrecl=100000 ;
length col1-col&n_cols $32767 ;
input (col:)(:) ;
put (col:)(:) ;
LIST;
run ;[/pre]although that has completed the work required, the following step conveniently displays the '09'x as the new column delimiters, with protected commas remaining among the data[pre]data _null_ ;
infile "your_file2" ;
INPUT @ ;
LIST;
run ;[/pre]
Hope that is clear and helps.
PeterC