BookmarkSubscribeRSS Feed
acordes
Rhodochrosite | Level 12

I want to resolve in one join what actually requires a secondary data step. 

In my understanding I cannot use the exists operator as fedsql on caslibs does not allow for this option. 

The following code does what it should but I want the (fedsql) to return only these rows form the left table that do not exist in the second table. 

 

proc cas;
source MPG_toyota;
    create table public.sum22{options replace=true as 
      select a.*, case when b.codopera='' then 0 else 1 end as flagy 
               from PUBLIC.JS_MTOS_V2AA a left join MKT.OUTYS b 
      on b.codopera=a.codopera    ;
endsource;
fedSQL.execDirect / query=MPG_toyota;
quit;

data public.sum22;
set public.sum22;
where flagy=0;
run;

 

4 REPLIES 4
Tom
Super User Tom
Super User

The documentation seems to clearly say that FEDSQL supports EXISTS.

https://documentation.sas.com/doc/en/pgmsascdc/v_034/fedsqlref/n0j8gspb9heiqgn1rneohxqxx3s3.htm

 

Is there some place where it is documented that you cannot use it from PROC CAS?

PGStats
Opal | Level 21

I am not a fedSQL user but for such a simple condition, you could use

 

select * from PUBLIC.JS_MTOS_V2AA
where codopera not in (select codopera from MKT.OUTYS)

No?

PG
acordes
Rhodochrosite | Level 12

Thank you, I had tried it already.

 

It returns the error:

 

ERROR: Unsupported operation in FedSQL query: IN/ANY/ALL subquery.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 527 views
  • 0 likes
  • 3 in conversation