WHERE CLAUSE

Reply
Super Contributor
Posts: 1,041

WHERE CLAUSE

Hi ,

I am trying to use this code in SAS9.4 and it says

"where clause has been augmented" .....giving me zero records.

If I don't put the where same and .......... I am getting records

Could you please give me some insights where I am going wrong???

Thanks

data want;

set have;

where Key4 between &bgndt and &enddt;

where same and Key1 ne 1999 and Key2 = 1555 and Key3 IN (12, 15);

run

;

Trusted Advisor
Posts: 1,931

Re: WHERE CLAUSE

Posted in reply to robertrao

We can't help you unless we can see your data and also what &bgndt and &enddt are.

Maybe you could narrow this down to a very small data set to show us.

Super User
Posts: 5,516

Re: WHERE CLAUSE

Posted in reply to robertrao

It's possible that you've done nothing wrong.  It's the data's fault.

When you remove SAME AND, the first WHERE statement is ignored.  You are getting records that satisfy only the second WHERE statement.

When you add SAME AND, the selected observations have to satisfy both WHERE statements.  Perhaps there are no observations in your data that satisfy both WHERE statements.

Good luck.

Super User
Posts: 5,434

Re: WHERE CLAUSE

Posted in reply to robertrao

Using same as  here makes no sense. Merge your where cluse.

Data never sleeps
Super User
Posts: 10,041

Re: WHERE CLAUSE

Posted in reply to robertrao

It looks like you shouldn't use double WHERE clause . But you can also do it so by :

data want;
set sashelp.class;
where sex='M';
where also age=15;
run;

Xia Keshan

Ask a Question
Discussion stats
  • 4 replies
  • 457 views
  • 0 likes
  • 5 in conversation