LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 10 Jul 2001 10:52:55 -0400
Reply-To:   "Diskin, Dennis" <Dennis.Diskin@PHARMA.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Diskin, Dennis" <Dennis.Diskin@PHARMA.COM>
Subject:   Re: reading a datafile with comment in the beginning
Comments:   To: Miguel <miguel-van-den.heuvel@UNILEVER.COM>
Content-Type:   text/plain

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


Back to: Top of message | Previous page | Main SAS-L page