Date: Sat, 2 Apr 2005 19:07:32 -0500
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: how to input this file
Or
data xx;
infile cards dlm=' ,' missover;
input id @;
do until (missing(w) );
input w @;
if not missing(w) then output;
end;
cards;
On Sat, 2 Apr 2005 18:29:00 -0500, Ya Huang <ya.huang@AMYLIN.COM> wrote:
>Try to read in as one long string, then use scan to break it into
>many pieces:
>
>data xx;
>infile cards;
>input;
>id=scan(_infile_,1,',');
>stop=1;
>do i=2 by 1 while(stop);
>w=scan(_infile_,i,',');
>if w='' then stop=0;
>else output;
>end;
>drop i stop;
>cards;
>2, 3, 4, 45
>1,4
>3,6,7
>4,8,9,67,34,45
>;
>
> id w
>
> 2 3
> 2 4
> 2 45
> 1 4
> 3 6
> 3 7
> 4 8
> 4 9
> 4 67
> 4 34
> 4 45
>
>Kind regards,
>
>Ya Huang
>
>On Sat, 2 Apr 2005 15:07:36 -0500, Jianping Zhu <zhujp98@GMAIL.COM> wrote:
>
>>I have a file t1.txt with follwing contecnt:
>>2, 3, 4, 45
>>1,4
>>3,6,7
>>4,8,9,67,34,45
>>
>>I want to create a dataset from above file, the dataset should be:
>>2 3
>>2 4
>>2 45
>>1 4
>>3 6
>>3 7
>>4 8
>>4 9
>>4 67
>>4 34
>>4 45
>>how can i do that?
>>Thanks
|