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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 3931 views
  • 1 like
  • 2 in conversation