Calcite | Level 5

## code problems

what does this code means?

(first.id and last.id)<1 and (first.id and last.id)<1"

<1 for what meanings?

part of the dataset:

id   day1

1   2000/01/01

1   2000/01/01

1   2001/12/15

1   2001/12/31

2   2005/03/04

2   2005/03/04

2   2005/05/06

2   2006/07/09

2   2006/08/09

3   2008/01/15

3   2009/05/25

3   2009/07/15

thank you~

8 REPLIES 8
Diamond | Level 26

## Re: code problems

This means less than, i.e. if (first.id and last.id) is less than 1.

Sybols are:

< less than

> greater than

<= less than or equal to

>= greater than or equal to

There are several others in the SAS help.

Super User

## Re: code problems

(first.id and last.id) only has two value either  0  or 1 . Therefore,   (first.id and last.id)<1 is the same with (first.id and last.id)=0

PROC Star

## Re: code problems

Ksharp,

You solved my earlier riddle, so here's a new one related to this question.  What does this statement do?

if a=1 or 2 then b=3 and c=4;

Yes, it will run without error.  But what does it do?

Super User

## Re: code problems

Hi, Astounding

That is an old scam . 2 is always be true , therefore a=1 or 2 is always be true too , you are going to execute the following statement always .Am I right ?

Xia Keshan

PROC Star

Super User

## Re: code problems

That is strange code , Can you explain it ?

Oh , I understood .

then b=(2 and c=2) ;

Super User

## Re: code problems

B is set to 0 (false) and if C doesn't exist you get a missing value for an uninitialized variable.

3 and c evaluates to false unless c = 4 then you get 3 and true (c=4) so true and true = true for B.

PROC Star