| Date: | Wed, 28 Sep 2011 09:54:21 -0400 |
| Reply-To: | Jeff Kroll <jeffrey.kroll@US.ING.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jeff Kroll <jeffrey.kroll@US.ING.COM> |
| Subject: | Re: Proc Import and Excel |
|---|
OK, I gave it a try and SAS seems to be ignoring what I tell it. Here is
the code I ran:
PROC IMPORT OUT=ace0211
FILE="c:\temp\ace0211.xls"
DBMS=EXCEL REPLACE;
RANGE='A1:L32765';
GETNAMES=YES;
DBDSOPTS="DBTYPE=(Reason_Codes='Char(8)')";
RUN;
The Reason_Codes column is still showing as numeric when I list the columns.
Jeff
On Wed, 28 Sep 2011 08:13:40 -0500, Joe Matise <snoopy369@GMAIL.COM> wrote:
>You can force SAS to read them as text using the DBSASTYPE option. It's
>something like this:
>proc import file="whatever.xls" data=whatever dbms=excel replace;
>dbdsopts=(dbsastype("var1='NUMERIC(8)' var2='CHAR(3)'));
>run;
>
>I don't tend to remember the exact combination of ( and = and " for this, so
>the above is probably slightly off, but you can google it and get the right
>combination, or when I get into work i'll look at some code I have that does
>it properly.
>
>-Joe
>
>On Wed, Sep 28, 2011 at 7:44 AM, Jeff Kroll <jeffrey.kroll@us.ing.com>wrote:
>
>> I have multiple spreadsheets Im importing. On one of the spreadsheets a
>> column is all numbers on other spreadsheets its mixed. When I bring these
>> together I get an error saying the field has been defined as both numeric
>> and character. On the spreadsheet that has the values as all numeric I
>> tried formatting the column as text but SAS seems to ignore it. Is there a
>> way to force SAS to see the column as text? I even tried inserting a row
>> after the heading with X's in that particular column but that didnt work
>> either. I have many spreadsheets and dont want to have to edit each of
>> them.
>>
>> Thanks
>>
>> Jeff Kroll
>>
|