Date: Thu, 1 May 2008 09:50:19 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>"
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>"
Subject: Re: String question
On Thu, 1 May 2008 08:16:37 -0400, Richard A. DeVenezia
>Dominic Mitchell wrote:
>> input var1 var2 $6.;
>> 99 9982
>> 998 998
>The INPUT statement indicates var1 is numeric and var2 is character. Is
>this the real situation ? If so, it was not working because var1 (the
>numeric) was being implicitly cast as a character string for the comparison,
>and when auto-casting, the format is 8.,
I believe it's BEST12. Try:
n = 1/3;
c = translate(n,'*',' ');
>which is right aligned, which means
>the autocast value has leading space, which means the =: operation does not
>meet your intuition.
>Regardless of the real situation, this will work when var2 is character and
>var1 is numeric or character.
> if var2=:cats(var1);
Interesting. Basically, CATS acts like STRIP here, except that it issues no
NOTE about type conversion.
Let's make the test data more demanding, as in:
input var1 var2 $6.;
The last observation passes the IF condition, incorrectly. That's because
the colon modifier works symmetrically, truncating whichever operand is longer.
>Richard A. DeVenezia