I'm trying to read in this set of data and I need some help: A123456789,A,3 1,Y,15Feb1960,M,M,3,FT,55000 2,N,3Jun1965,F,M,3,UE,0 A135790234,B,1 1,Y,19Oct1944,F,D,0,NA,3000 B234523456,A,2 1,Y,30Jun1978,F,M,1,PT,4000 2,N,21May1975,M,M,2,FT,30000 I need the output to look like this: I have come up with this solution which works fine: Data Yourdata (drop=temp);
Infile datalines dsd;
retain var1-var3;
input temp : $10. @;
if length(temp) ^= 1 then do;
Input @1 var1 $10.
@12 var2 $
var3 $
var4
var5 $
var6 : date9.
var7 $
var8 $
var9
var10 $
var11 ;
end; else do;
Input @1 var4
var5 $
var6 : date9.
var7 $
var8 $
var9
var10 $
var11 ;
end;
format var6 date9.;
datalines;
A123456789,A,3
1,Y,15Feb1960,M,M,3,FT,55000
2,N,3Jun1965,F,M,3,UE,0
A135790234,B,1
1,Y,19Oct1944,F,D,0,NA,3000
B234523456,A,2
1,Y,30Jun1978,F,M,1,PT,4000
2,N,21May1975,M,M,2,FT,30000
;
run; However, I'm partially using formatted input instead of list input and I'm ignoring the delimiter for some of the columns. I am wondering if there is a better solution for this. Can anyone help? Thanks 🙂
... View more