Date: Fri, 12 Oct 2001 09:54:06 -0400
Reply-To: Doc Muhlbaier <lawrence.muhlbaier@DUKE.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Doc Muhlbaier <lawrence.muhlbaier@DUKE.EDU>
Organization: Duke University, Durham, NC, USA
Subject: Re: reading csv file with abnormal returns
One possibility is the .csv file originated in another operating system, or
that you are working in another OS from Excel. I've had similar problems
when the file came from Unix (with a binary FTP or Samba connection) and I
was working on a PC. Unix uses the <CR> as it's end of line marker and the
PC uses <CR><LF>.
If that is the case you might try the unix2dos utility (just do a goole
search to find it) to convert the end-of-line markers.
Doc
"Sarah Whittier" <swhittier@ISO-NE.COM> wrote in message
news:200110112217.f9BMHOr14104@listserv.cc.uga.edu...
> I have a csv file from a vendor. When I open it in Excel, it looks fine.
> There is nothing unusual about the data, although the first var is very
> long. However, I cannot read it into SAS normally. When I run proc
> fslist, the whole file shows as one line, with what are observations in
> Excel separated by little square characters, and variables separated by
> commas.
>
> The closest I've gotten to reading it correctly is with the following:
>
> data coal;
> infile 'd:\my documents\coaldata.csv' dsd dlm='2C0D'x firstobs=2;
> informat date date.;
> input quote :$200.
> ewid :$10.
> ric :$12.
> date
> high
> low
> best ;
> run;
>
> This gives me a file with correct data for every second or third
> observation, but skips obs in between.
>
> I've tried the trailing @@, and got garbage.
>
> Does anyone have a suggestion for how to correctly read the return
> characters to get all the observations? In the long run, we'll try to get
> the vendor to fix the format, but for now I need to read the files we
have.
>
> Thanks.
>
> Sarah Whittier
|