That should work in this case, assuming that there are no multiple spaces
within the character strings.
However, there would be a problem if there were more columns to read after
DESC. They would get eaten up.
I suggest coding the NOTAB option on the FILENAME statement and the
DLM='09'x and DSD options on the INFILE.
On Tue, 27 Jul 2004 08:58:23 -0400, Nat Wooding < XXXX@XXXXX.COM >
wrote:
>Mark
>
>Try adding an & after the variable desc .
>
>Nat Wooding
>
>data a;
>length desc $255.;
>input Code Recode Desc &;
>cards;
>1 2 Value1
>2 2 Value1
>3 6 Value Other
>4 6 Value Other
>5 4 Value2
>proc print;run;
>
>
>
> Mark Biek
> <markb@STEVENSONC To: SAS-
XXXX@XXXXX.COM
> OMPANY.COM> cc:
> Sent by: "SAS(r) Subject: Problem reading
Excel data containing spaces w/ dde
> Discussion"
> < XXXX@XXXXX.COM
> GA.EDU>
>
>
> 07/27/04 08:47 AM
> Please respond to
> Mark Biek
>
>
>
>
>
>
>I have some data in Excel that looks like this:
>
>Code Recode Desc
>1 2 Value1
>2 2 Value1
>3 6 Value Other
>4 6 Value Other
>5 4 Value2
>
>Which I'm trying to read in using the following code:
>
>filename q2 dde "excel|q2!r2c2:r42c4";
>data rc_q2;
> length desc $255.;
> infile q2;
>
> input code recode desc;
>run;
>
>It works except the Desc field is truncated whenever there is a space
>so Code 3 ends up being:
>
>3 6 Value
>instead of
>3 6 Value Other
>
>What do I need to do to get the whole field?
>
>Thanks,
>Mark
>
>--
>Mark Biek
>The Stevenson Company
>8700 Westport Rd. Ste. 200
>Louisville, KY 40242-3100
>(502) 429-9060 ext 251