Nest multiple WHERE statements in PROC SQL

Accepted Solution Solved
Reply
Contributor
Posts: 41
Accepted Solution

Nest multiple WHERE statements in PROC SQL

Hello,

I need to nest multiple WHERE statements in a PROC SQL as follows

  • Amount must be greater than 5000

AND

  • Purpose must be either 0 OR 1

In pseudo code I would expect something like: WHERE (Amount > 5000) AND (Purpose = 0 OR 1);

How can I achieve this with PROC SQL?

Regards,

P.


Accepted Solutions
Solution
‎12-19-2012 04:41 PM
Super User
Posts: 3,102

Re: Nest multiple WHERE statements in PROC SQL

Where amount > 5000 and purpose in (0,1)

View solution in original post


All Replies
Solution
‎12-19-2012 04:41 PM
Super User
Posts: 3,102

Re: Nest multiple WHERE statements in PROC SQL

Where amount > 5000 and purpose in (0,1)

Super Contributor
Posts: 1,636

Re: Nest multiple WHERE statements in PROC SQL

try:

WHERE Credit_Amount > 5000 and compress(lowcase(Purpose)) IN ('car (new)','car (used)')

Contributor
Posts: 41

Re: Nest multiple WHERE statements in PROC SQL

Hi,

I'm afraid that doesn't solve my issue. But I found out what was the issue. Our teacher gave us a cheeky, tricky question.  Smiley Happy

Thank you

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 245 views
  • 3 likes
  • 3 in conversation