There a probably a number of ways. One might be something like:
[pre]
data need;
infile "c:\test.txt";
length id $3;
length studentname $10;
input;
if _infile_ ne "" then do;
if anydigit(substr(_infile_,1,1)) then do;
id=scan(_infile_,1);
studentname=scan(_infile_,2);
age=input(scan(_infile_,3),best12.);
weight_pounds=input(scan(_infile_,4),best12.);
output;
end;
end;
run;
[/pre]
Art
> I have a text file test.txt like this :
>
> This is class room 1
>
> ID STUDENTNAME AGE WEIGHT(pounds)
> 1 Robert 13 70
> 2 Mary 12 75
> 3 Nicole 11 79
> This is class room 2
>
> ID STUDENTNAME AGE WEIGHT(pounds)
> 4 charles 15 80
> 5 Kathy 14 85
> 6 Jen 10 70
> e above is test.txt file.I have to import it as data
> set given below:
>
> ID STUDENTNAME AGE WEIGHT(pounds)
> 1 Robert 13 70
> 2 Mary 12 75
> 3 Nicole 11 79
> 4 charles 15 80
> 5 Kathy 14 85
> 6 Jen 10 70