Date: Wed, 16 Apr 2008 18:49:33 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: VERY EASY EXCEL question
Tom,
As I mentioned, the code should work unless the original field was text.
I lied, but not on purpose. You wanted '123', and the statement I
suggested would actually produce '123,'
Obviously easy to fix but, if your initial field is actually character,
try the following:
PROC IMPORT OUT= WORK.have
DATAFILE= "c:\have.xls"
DBMS=EXCEL2000 REPLACE;
mixed=yes;
GETNAMES=YES;
RUN;
data want;
set have;
b=cats(a,"'");
c=cats(a,"',");
run;
PROC EXPORT DATA= WORK.want
OUTFILE= "c:\want.xls"
DBMS=EXCEL2000 REPLACE;
RUN;
The left side quote won't appear, but should be there.
Art
--------
On Wed, 16 Apr 2008 16:21:08 -0500, Tom White <tw2@MAIL.COM> wrote:
>Arthur,
>
>Thank you for this code.
>
>However, it dosn't seem to do what I need.
>
>The output for column B looks like
>
> '
>
>when it should look like, say,
> '123'
>
>or like, say, '123',
>
>which was my original question.
>
>T
>
>----- Original Message -----
>From: "Arthur Tabachneck"
>To: SAS-L@LISTSERV.UGA.EDU, "Tom White"
>Subject: Re: VERY EASY EXCEL question
>Date: Wed, 16 Apr 2008 16:54:09 -0400
>
>
>Tom,
>
>Since you posted this on SAS-L, here is a SAS-based solution:
>
>PROC IMPORT OUT= WORK.have
>DATAFILE= "c\have.xls"
>DBMS=EXCEL2000 REPLACE;
>GETNAMES=YES;
>RUN;
>
>data want;
>set have;
>b=cats(input(put(a,5.),$8.),"'");
>c=cats(input(put(a,5.),$8.),",'");
>run;
>
>PROC EXPORT DATA= WORK.want
>OUTFILE= "c:\want.xls"
>DBMS=EXCEL2000 REPLACE;
>RUN;
>
>HTH,
>Art
>---------
>On Wed, 16 Apr 2008 14:41:37 -0500, Tom White wrote:
>
>> SAS-L,
>>
>> I have an Excell sheet with one numeric column like:
>>
>> A
>> 123
>> 456
>> 789
>>
>> I would like to populate the next field over with
>>
>> B
>> '123'
>> '456'
>> '789'
>>
>>
>> If you can do the above, can you also do:
>> C
>> '123',
>> '456',
>> '789',
>>
>>
>>
>> I try to do:
>>
>>
>> =" 'A2' "
>>
>> but doesn't work.
>>
>> Thanks.
>>
>> t
>>
>> --
>> Want an e-mail address like mine?
>> Get a free e-mail account today at www.mail.com!
>
>
>--
>Want an e-mail address like mine?
>Get a free e-mail account today at www.mail.com!
|