Date: Tue, 17 Oct 2006 16:34:35 -0400
Reply-To: Jake Bee <johbee@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jake Bee <johbee@GMAIL.COM>
Subject: Re: input data not consistent
In-Reply-To: <1161115275.694916.233970@e3g2000cwe.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
As an example:
But your infile would be you .csv file. Perhaps you want to also look at
proc import.
Also, if you .csv file contains ' ',' ' --then you may need to clean that
up inorder to get the
results you want.
dm 'log' clear;
dm 'out' clear;
data mydata1;
infile datalines delimiter='",';
input v1 $ v2 $ v3 $ v4 $ v5 $ @;
datalines;
N,X,"A",Y,"B"
N,X,"A",Y,"B"
;
run;
proc print data=mydata1;
run;
data mydata2;
infile datalines delimiter='",';
input v1 $ v2 $ v3 $ v4 $ v5 $ @;
datalines;
N,X,"A
",Y,"B"
N,X,"A",Y,"B"
;
run;
proc print data=mydata2;
run;
On 10/17/06, jjj912@yahoo.com <jjj912@yahoo.com> wrote:
>
> My input data is comma delimited and it normally looks like either
> N,X,"A",Y,"B"
> N,X,"A",Y,"B"
>
> However, sometimes it looks like
> N,X,"A
> ",Y,"B"
> N,X,"A",Y,"B"
>
> The data for a single observation is on two lines sometimes. How would
> I go about telling SAS to look at the next line to see if the current
> observation spans two lines and, if so, to read the second line for the
> rest of the data?
>
|