BookmarkSubscribeRSS Feed
richard_hu2003
Calcite | Level 5
Given the SAS data sets:

WORK.EMPLOYEE WORK.NEWEMPLOYEE

Name Dept Names Salary
-------- ----- -------- ------
Alan Sales Michelle 50000
Michelle Sales Paresh 60000

A SAS program is submitted and
the following is written to the SAS log:
101 proc sql;
102 select dept, name
103 from WORK.EMPLOYEE
104 where name=(select names
from newemployee
where salary > 40000)
ERROR: Subquery evaluated to more than one row.
105 ;
106 quit;
What would allow the program to
successfully execute without errors?
A.
Replace the where clause with:
where EMPLOYEE.Name=(select Names delimited with ','
from WORK.NEWEMPLOYEE
where Salary > 40000);
B.
Replace line 104 with:
where EMPLOYEE.Name =ANY (select Names separated with ','
from WORK.NEWEMPLOYEE
where Salary > 40000);
C.
Replace the equal sign with the IN operator.
D.
Qualify the column names with the table names.
Answer:(C)

I am wondering why (B) is not correct. Any thoughts? Thanks a lot.
2 REPLIES 2
RickM
Fluorite | Level 6
Because =ANY(...) is not a valid SQL statement in SAS.
DBailey
Lapis Lazuli | Level 10
presuming newemployee exists and you can match on the name column.

where name in (select name
from newemployee
where salary > 40000)

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 1287 views
  • 0 likes
  • 3 in conversation