BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Edoedoedo
Pyrite | Level 9

Hi, we've just got Sas Viya 3.4 and I'm studying it to understand how can I improve my SAS 9.4 programs.

 

I have a problem with proc sql, which as I saw exists only as proc fedsql. However, here's my caslib:

 

 

caslib mycaslib path="/sas/staging/test" datasource=(srctype="path") libref=mycas;

 

 

Inside that path there exists a table named test.sashdat. I load such a table in memory:

 

proc casutil incaslib="mycaslib" outcaslib="mycaslib";
    load casdata="test.sashdat" casout="test" replace;
run;

 

Now I want, for instance, to aggregate that table to count rows by FIELD1.

 

proc fedsql;
    CREATE TABLE mycas.counts AS
    select FIELD, count(*) as N
    from mycas.test
    group by FIELD;
quit;

I get this error:

 ERROR: Table "MYCAS.TEST" does not exist or cannot be accessed
 ERROR: BASE driver, schema name MYCAS was not found for this connection

What is wrong?

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rahul_B
Obsidian | Level 7

Hi, 

 

You are accessing CAS lib in fedsql but you dont have any session reference of CAS ?  It is not a config issue.

 

 

 

cas mySession sessopts=(caslib=mycas timeout=3600 locale="en_US" metrics=true);
proc
fedsql sessref=mySession;
CREATE TABLE mycas.counts AS
select FIELD, count(*) as N
from mycas.test
group by FIELD;
quit;

 

I hope this should fix your problem.

View solution in original post

3 REPLIES 3
Edoedoedo
Pyrite | Level 9

Hi, does anyone have the same error or does it happen only on my config?

 

Thank you

Rahul_B
Obsidian | Level 7

Hi, 

 

You are accessing CAS lib in fedsql but you dont have any session reference of CAS ?  It is not a config issue.

 

 

 

cas mySession sessopts=(caslib=mycas timeout=3600 locale="en_US" metrics=true);
proc
fedsql sessref=mySession;
CREATE TABLE mycas.counts AS
select FIELD, count(*) as N
from mycas.test
group by FIELD;
quit;

 

I hope this should fix your problem.

Edoedoedo
Pyrite | Level 9
Thanks a lot, the missing sessref was the problem!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 3 replies
  • 5113 views
  • 1 like
  • 2 in conversation