Date: Sun, 27 Mar 2011 14:50:01 -0400
Reply-To: Peter Flom <peterflomconsulting@MINDSPRING.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Flom <peterflomconsulting@MINDSPRING.COM>
Subject: Re: Reading numeric data from a CSV file as if it was categorical
In-Reply-To: <201103271828.p2RApPoE016731@waikiki.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Art
I was wrong..... GUESSINGROWS does do it, I just set it to the maximum
(32767) and that does it. It takes a little while, but that's OK
Thanks for easy solution!
Peter
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Arthur
Tabachneck
Sent: Sunday, March 27, 2011 2:29 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Reading numeric data from a CSV file as if it was categorical
Peter,
Will the combination of setting guessingrows and mixed=yes work?
If not, you can find a macro at:
http://www.nesug.org/proceedings/nesug03/ps/ps019.pdf
HTH,
Art
-------
On Sun, 27 Mar 2011 14:13:39 -0400, Peter Flom
<peterflomconsulting@MINDSPRING.COM> wrote:
>Hello
>
>
>
>I have to read in data from 17 large (each is many megabytes) csv files.
>They have some columns where the data is really categorical, but where
>the vast majority uses numerical codes, but somewhere (hundreds of
>lines in) there is text data.
>
>
>
>Of course, this makes SAS complain
>
>
>
>Ordinarily, I'd fix all this up in Excel. But with so many large files
that
>would be a major PITA. So, how can I tell SAS that some columns should
>be categorical
>
>
>
>I wrote a mini-macro to read in the files:
>
>
>
>%macro imp(filename);
>
>PROC IMPORT OUT= WORK.&filename
>
> DATAFILE= "C:\personal\Consults\Olivia Dixon\&filename..csv"
>
> DBMS=CSV REPLACE;
>
> GETNAMES=YES;
>
> DATAROW=2;
>
>RUN;
>
>%mend imp;
>
>
>
>%imp(file1);
>
>
>
>
>
>And I then use it on 17 files.
>
>
>
>TIA as always
>
>
>
>Peter Flom
>
>Peter Flom Consulting
>
>http://www.statisticalanalysisconsulting.com/
>
>http://www.IAmLearningDisabled.com
|