Date: Sun, 29 Jan 2006 20:30:32 +0000
Reply-To: iw1junk@COMCAST.NET
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <iw1junk@COMCAST.NET>
Subject: Re: Drop odd rows after reading from a Text file
Eric,
It depends on what you find interesting.
data w ;
input v1-v5 @@;
if (v2 NE .) then do;
input / v1-v5 +1;
output;
end;
else input +(-1);
cards ;
1
13 87.65 98.76 90.23 87.00
2
83 15.23 90.56 87.12 25.87
3
93 87.65 98.76 90.23 87.00
4
13 87.65 98.76 90.23 87.00
5
83 15.23 90.56 87.12 25.87
;
produces
NOTE: LOST CARD.
RULE:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+
19 ;
v1=5 v2=83 v3=15.23 v4=90.56 v5=87.12 _ERROR_=1 _N_=3
NOTE: SAS went to a new line when INPUT statement reached past the end of a
line.
NOTE: The data set WORK.W has 2 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 1.43 seconds
cpu time 0.88 seconds
On the other, hand either
input / @@ ;
input v1-v5 ;
or
input @@ ;
input #2 v1-v5 ;
would work, but the main interest would be in the programmer not the
program since not using @@ is simpler.
If you don't mind the note about the intentional going to the next line
message, then
input skip v1-v5 @@ ;
would work, but you might want to rename SKIP to ID or some other
identifier. I think it is probably best to always provide some record
so I would have suggested
input rec_id / v1-v5 ;
Ian Whitlock
================
Date: Sun, 29 Jan 2006 11:35:46 -0800
Reply-To: Eric Hoogenboom <erichoogenboom@YAHOO.COM>
Sender: "SAS(r) Discussion"
From: Eric Hoogenboom <erichoogenboom@YAHOO.COM>
Organization: http://groups.google.com
Subject: Re: Drop odd rows after reading from a Text file
Comments: To: sas-l
In-Reply-To: <200601291814.k0TBkLoW001363@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="iso-8859-1"
Howard,
How about:
input v1-v5 @@;
if (v2 NE .) then do;
input / v1-v5 +1;
output;
end;
else input +(-1);
Interesting enough? ;-)
Eric