|
This is fairly common. You have to learn about the placeholder cod "@';
When the @ is the last item in your input statement, it tells SAS to keep
that line in the input buffer for additional processing.
See untested example below.
hth,
Denis Diskin
data products;
infile 'm:\sas\wmtest\products.txt' dlm='09'x ;
input @1 commdlm $1. @;
if commdlm = '*' then delete;
drop commdlm;
input @1 product_id $ combination_limit;
> -----Original Message-----
> From: Miguel [SMTP:miguel-van-den.heuvel@UNILEVER.COM]
> Sent: Tuesday, July 10, 2001 10:33 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: reading a datafile with comment in the beginning
>
> Hi,
>
> I've been stuck with this problem for a couple of weeks now and I
> can't seen to figure it out and maybe someone can help me.
>
> I've to read a number of datafiles with comment in the beginning that
> look like this:
>
> --------------------------------------------------------------------------
> *
> * This is comment and is very usefull if you want to understand te
> contents of
> * this datafile but quite annoying if you want to read this file into
> SAS
> *
> 1567 2
> 1568 9
> 1687 45
> --------------------------------------------------------------------------
> -
>
> The lines with a star in the beginning have to be ignored by SAS. Now
> I'm using the following code to read this set (the delimiter is a TAB)
>
> --------------------------------------------------------------------------
> -
> data products;
> infile 'm:\sas\wmtest\products.txt' dlm='09'x firstobs=5;
> input product_id $ combination_limit;
> --------------------------------------------------------------------------
> -
>
> However this is very impractical because the number of '*' varies with
> each different dataset and I would like SAS to figure out on its own
> that it has to ignore a line with a '*' in the beginning.
> Can anybody help me with this one???
>
> Miguel van den Heuvel
|