f



Re: functionality of the in(xxx:xxx) function #4

On Thu, 15 Jun 2006 08:35:46 -0700, Choate, Paul@DDS <pchoate@DDS.CA.GOV>
wrote:

>Jon-
>
>then mailid = 21 and lettertextid = 'LA2';
>
>should be two separate statements
>
>then do;
>mailid = 21;
>lettertextid = 'LA2';
>end;

And there was probably a clue in Jonathan's log:

   NOTE: Variable lettertextid is uninitialized.

The code was syntactically OK. The statement

   mailid = 20 and lettertextid = 'LA1';

or

   mailid = ( 20 and lettertextid = 'LA1' );

will first compare the variable LETTERTEXTID to the literal "LA1",
yielding probably a 0 (false) though possibly a 1( true). In either case,
when this result is ANDed to 20, the result is 0 (false).

>
>
>hth
>
>Paul Choate
>DDS Data Extraction
>(916) 654-2160
>
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>> Jonathan Woodring
>> Sent: Thursday, June 15, 2006 8:26 AM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: functionality of the in(xxx:xxx) function
>>
>> If I am not mistaken (which I probably am), then in operator seems to
>be
>> malfunctioning. SAS 9.1.3. The following code:
>>
>>
>>
>> data cms.drop1criteriafinal;
>>
>>       set cms.drop1criteriaexport;
>>
>>       if _N_ in(1:5000) then mailid = 20 and lettertextid = 'LA1';
>>
>>             else if _N_ in(5001:10000) then mailid = 21 and
>lettertextid
>> = 'LA2';
>>
>>             else if _N_ in(10001:15000) then mailid = 23 and
>> lettertextid = 'LA3';
>>
>>             else if _N_ in(15001:20000) then mailid = 24 and
>> lettertextid = 'LA4';
>>
>>             else if _N_ in(20001:25000) then mailid = 25 and
>> lettertextid = 'LA5';
>>
>>             else if _N_ in(25001:30000) then mailid = 26 and
>> lettertextid = 'LA6';
>>
>> run;
>>
>>
>>
>> results in a variable 'mailid' that has a value of 0 for all
>> observations, while the variable 'lettertextid' is missing for all
>> observations. I've stared at the syntax and played around, to no
>avail.
>> Am I missing something here? Thanks guys!
>>
>>
>>
>> Jonathan
0
nospam1405 (4666)
6/15/2006 4:38:39 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
521 Views

Similar Articles

[PageSpeed] 8

Reply: