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!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 4722 views
  • 1 like
  • 2 in conversation