Re: Read Excel into SAS #2

  • Follow


IIRC, there is some rule SAS uses to decide whether a column in Excel is
character or numeric.  By default it checks only the first 8 rows, and
makes a decision based on whether there is more alpha data or numeric
data.  I seem to recall there being a way to expand this option so it
would check all rows, maybe by messing with the register?

I found the following link:
http://support.sas.com/techsup/unotes/SN/004/004924.html
which describes the issue, and says things may get better in v9/9.1:

<quote>
Using SAS 9.0, customers can use Excel LIBNAME statement with the
MIXED=YES option.

Beginning with SAS 9.1, the IMPORT procedure will support the option
MIXED=YES.

This option will allow automatic conversion of numeric to character when
the datatype has been determined to be character.
</quote>

That sounds a little better, but not quite what I would prefer.  My memory
is DBMS copy simply made the rule "If the column has any non-numeric data,
make it a character variable and convert numerics to character."  I liked
that method, and with SAS's purchase of DBMS copy, was hopeful that some
of Feldman's conversion routines would get incorporated into proc import,
SAS/ACCESS, etc...

Kind Regards,
--Quentin

On Wed, 3 Mar 2004 07:36:43 -0800, Choate, Paul@DDS <pchoate@DDS.CA.GOV>
wrote:

>Dear SS - A favorite kludge...insert some dummy alpha data in the first
few
>rows, import, and then delete those rows.
>
>hth
>
>Paul Choate
>DDS Data Extraction
>(916) 654-2160
>
>-----Original Message-----
>From: S. S. [mailto:sassysaser@YAHOO.COM]
>Sent: Wednesday, March 03, 2004 7:14 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Read Excel into SAS
>
>I have an Excel file with a column. Most of the values for this column
>are numbers, and the rest are characters. In Excel, I formatted the
>column to be a text field. Then in SAS I referred to this file with
>the following codes:
>
>libname excel odbc complete="dsn=Excel Files;dbq=C:\Master.xls";
>
>The problem is the column is set by SAS as a numeric field and the
>cells where the original values are characters are now missing. What
>should I do?
0
Reply Quentin_McMullen (230) 3/3/2004 4:26:28 PM


0 Replies
24 Views

(page loaded in 0.018 seconds)


Reply: