From: Emil on
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
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
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
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.