Date: Sat, 2 Apr 2005 18:29:00 -0500
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ya Huang <ya.huang@AMYLIN.COM>
Subject: Re: how to input this file
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
|