BookmarkSubscribeRSS Feed
tz0715
Calcite | Level 5

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
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Ksharp
Super User

(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

Astounding
PROC Star

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?

Ksharp
Super User

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

Astounding
PROC Star

You're right about the IF condition.  What about the THEN result?

Ksharp
Super User

That is strange code , Can you explain it ?

Oh , I understood .

then b=(2 and c=2) ;

ballardw
Super User

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.

Astounding
PROC Star

Good answer.

B will be 0 or 1, depending on the value of C.  "3" is always true.  So when C=4, B is set to 1.  For any other value of C (including missing), B is set to 0.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1000 views
  • 0 likes
  • 5 in conversation