WHERE CLAUSE

Reply
Super Contributor
Posts: 1,040

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,612

Re: WHERE CLAUSE

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,081

Re: WHERE CLAUSE

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,256

Re: WHERE CLAUSE

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

Data never sleeps
Super User
Posts: 9,676

Re: WHERE CLAUSE

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
  • 402 views
  • 0 likes
  • 5 in conversation