From: Emil on 15 Jul 2010 05:14 I have a problem with reading a file in which: end of the line is marked by a sign of the end of the line say " | ". So a line can be saved even in the three lines, after each character " | " line is a rigid format.... if anyone can help me read it. Emil
From: Patrick on 15 Jul 2010 07:50 Hi Emil Some demo data would help to come up with a solution suitable for your environment. Below a piece of code which reads data from several lines: ata have; infile datalines dsd dlm=',|'; input a b c d e; datalines; 1,2,3,4,5| 1,2,3 4,5| 1,,2 3 4,5| 1,2,3,4,5| ; run; proc print data=have; run; But as said: If your data looks different then one would have to read it a bit different. HTH Patrick
From: Emil on 16 Jul 2010 02:43 On 15 Lip, 13:50, Patrick <patrick.mat...(a)gmx.ch> wrote: > Hi Emil > > Some demo data would help to come up with a solution suitable for your > environment. > > Below a piece of code which reads data from several lines: > > ata have; > infile datalines dsd dlm=',|'; > input a b c d e; > datalines; > 1,2,3,4,5| > 1,2,3 > 4,5| > 1,,2 > 3 > 4,5| > 1,2,3,4,5| > ; > run; > > proc print data=have; > run; > > But as said: If your data looks different then one would have to read > it a bit different. > > HTH > Patrick Hi Patric the problem is that i have data like thise 12032009124|31023145 214|2441231234|2404120034| 1234432 where dat 1-8 a 9-10 b 11 and how handle with that kind of data :| Emil
From: Oleg on 16 Jul 2010 08:28 Hi, Emil. Try this code. data cc; length line $50. sline $200. dd $11.; retain sline; keep dd ; infile cards; input line $50.; substr(sline,length(sline)+1,length(line))=line; tt=countc(sline,'|'); if length(sline)>0 then do; if substr(sline, length(sline),1)='|' then do; do i=1 to tt; dd=left(scan(sline,i,'|')); output; end;sline=''; end; if tt=0 then do; dd=left(sline); output; end; end; cards; 12032009124|31023145 214|2441231234|2404120034| 1234432 ; Oleg.
|
Pages: 1 Prev: lag by group Next: Sustenance Lead - CA - 12 months Contract |