Date: Sun, 27 Mar 2011 14:13:39 -0400
Reply-To: Peter Flom <peterflomconsulting@MINDSPRING.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Flom <peterflomconsulting@MINDSPRING.COM>
Subject: Reading numeric data from a CSV file as if it was categorical
Content-Type: text/plain; charset="us-ascii"
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