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

I am exploring and trying out SAS VIYA.

I am asking about this because I'm testing this code below:

 

data casuser.NZstatdtx;
set myCaslib.NZstatdt;
ANZcode=(substr(ANZSIC06,1,3));
code_Desc=(substr(ANZSIC06,9,length(ANZSIC06)-8));
Area_cd=(substr(Area,1,4));
Area_name=(substr(Area,6,length(Area)-5));
drop ANZSIC06 Area;
run;

proc casutil;
	contents casdata="NZstatdt" INCASLIB=myCaslib ;
        contents casdata="NZstatdtx" INCASLIB=casuser ;
run;

I got the error below

75    
76    
77    data casuser.NZstatdtx;
78    set myCaslib.NZstatdt;
79    ANZcode=(substr(ANZSIC06,1,3));
80    code_Desc=(substr(ANZSIC06,9,length(ANZSIC06)-8));
81    Area_cd=(substr(Area,1,4));
82    Area_name=(substr(Area,6,length(Area)-5));
83    drop ANZSIC06 Area;
84    run;
NOTE: Running DATA step in Cloud Analytic Services.
NOTE: The DATA step will run in multiple threads.
NOTE: There were 36125 observations read from the table NZSTATDT in caslib MYCASLIB.
NOTE: The table NZstatdtx in caslib MYCASLIB has 36125 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           1.81 seconds
      cpu time            0.10 seconds
      
85    
86    proc casutil;
NOTE: The UUID ' ' is connected using session MYSESSION.
87    
87  !  contents casdata="NZstatdt" INCASLIB=myCaslib ;
NOTE: Cloud Analytic Services processed the combined requests in 0.001092 seconds.
88    contents casdata="NZstatdtx" INCASLIB=casuser ;
NOTE: The fileInfo action could not be run for the file "NZstatdtx".
ERROR: The table NZstatdtx could not be located in caslib CASUSER(test) of Cloud Analytic Services.
ERROR: The action stopped due to errors.
NOTE: Cloud Analytic Services processed the combined requests in 0.001008 seconds.
89    run;

When I try to do a proc contents for both source table and output table, I still says the output table cannot be located.

 

proc casutil;
	 
        contents casdata="NZstatdtx" INCASLIB=casuser ;
run;

Is the error I am getting due to the caslib not being active, if so how do you change active caslib in a particular session to prevent such error?

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pmyosh
Obsidian | Level 7

 

 

If I am not wrong, you have to declare the caslib everytime you use it to make it active.

Btw, You may do a proc contents directly without using casutil.

 

PROC CONTENTS DATA=myCaslib.Nzstatdtx ; RUN ;

 

View solution in original post

3 REPLIES 3
Pmyosh
Obsidian | Level 7

 

 

If I am not wrong, you have to declare the caslib everytime you use it to make it active.

Btw, You may do a proc contents directly without using casutil.

 

PROC CONTENTS DATA=myCaslib.Nzstatdtx ; RUN ;

 

johnfrytz
Obsidian | Level 7

Cheers @Pmyosh . Thanks for the response.

You are correct, I've just tried declaring  the caslib again.

Encountered no error in that portion.

cas mySession sessopts=(caslib="myCaslib");
caslib casuser list;
caslib myCaslib list;

Log:
95    cas mySession sessopts=(caslib="myCaslib");
NOTE: 'MYCASLIB' is now the active caslib.
NOTE: The CAS statement request to update one or more session options for session MYSESSION completed.
96    caslib casuser list;
NOTE: Session = MYSESSION Name = CASUSER(test)
         Type = PATH
         Description = Personal File System Caslib
         Path = /opt/sas/viya/config/data/cas/default/casuserlibraries/test/
         Definition = 
         Subdirs = Yes
         Local = No
         Active = No
         Personal = Yes
NOTE: Action to LIST caslib CASUSER completed for session MYSESSION.
97    caslib myCaslib list;
NOTE: Session = MYSESSION Name = MYCASLIB
         Type = PATH
         Description = 
         Path = /Users/test/workshop/
         Definition = 
         Subdirs = Yes
         Local = Yes
         Active = Yes
         Personal = No
NOTE: Action to LIST caslib MYCASLIB completed for session MYSESSION.

 

I guess , I need further understanding on proper usage of CASUTIL especially working with different caslib.

Pmyosh
Obsidian | Level 7

That's good! Yes, I think the casutil is still unexplored by lots of users like us.

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
  • 2533 views
  • 0 likes
  • 2 in conversation