Date: Tue, 12 Jun 2012 10:52:29 -0500
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: In() Function
In-Reply-To: <F7E6D18CC2877149AB5296CE54EA2766024DC263@WAXMXOLYMB002.WAX.wa.lcl>
Content-Type: text/plain; charset=ISO-8859-1
That's why we need documentation. :-)
On 6/12/12, Nordlund, Dan (DSHS/RDA) <NordlDJ@dshs.wa.gov> wrote:
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>> Joe Matise
>> Sent: Monday, June 11, 2012 6:34 PM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: Re: In() Function
>>
>> I interpreted Mike's rules to be:
>> *Works like WHICHN function, except that all arguments are truncated to
>> the
>> length of the first argument. This differs from WHICHN, which makes
>> each
>> comparison exactly (so 'IN' is not equal to 'INDEX'). IN('IN','INDEX')
>> would return TRUE.
>>
>> So whereas WHICHN will process each comparison as
>> IN1 = IN2
>> IN() processes each comparison as
>> IN1 =: IN2
>>
> <<<snip>>>
>
> Joe,
>
> The IN() function only "kind of works" like
>
> IN1 =: IN2
>
> The "=:" operator compares IN1 and IN2 up to the length of the shorter of
> the two strings, regardless of whether the shorter string is IN1 or IN2.
>
> The IN() function appears to return FALSE if IN2 is shorter than IN1.
>
> data _null_;
> in1 = 'abc';
> in2 = 'ab';
> compare1 = in(in1,in2);
> compare2 = in1 =: in2;
> put compare1= compare2=;
> run;
>
>
> Hope this is helpful,
>
> Dan
>
> Daniel J. Nordlund
> Washington State Department of Social and Health Services
> Planning, Performance, and Accountability
> Research and Data Analysis Division
> Olympia, WA 98504-5204
>
|