BookmarkSubscribeRSS Feed
jejobo2340
Fluorite | Level 6

I am running my first CAS code and I face an error. Seems like the file is not visible to CASLIB. I tried two different ways to address the path but both fails. Any hint?

 

cas mySession sessopts=(caslib=casuser timeout=1800 locale="en_US");

caslib casuser list;

proc casutil;
load file="&datadir./WorldData.xlsx" casout="myworlddata";
contents casdata="myworlddata";
run;

proc casutil;
load file="/Users/myemail@gmail.com/My Folder/WorldData.xlsx" casout="myworlddata";
contents casdata="myworlddata";
run;

Log:

 

1    %studio_hide_wrapper;
77   
78   cas mySession sessopts=(caslib=casuser timeout=1800 locale="en_US");
NOTE: 'CASUSER(myemail@gmail.com)' is now the active caslib.
NOTE: The CAS statement request to update one or more session options for session MYSESSION completed.
79   
80   caslib casuser list;
NOTE: Session = MYSESSION Name = CASUSER(myemail@gmail.com)
         Type = PATH
         Description = Personal File System Caslib
         Path = /cas/data/caslibs/casuserlibraries/myemail@gmail.com/
         Definition = 
         Subdirs = Yes
         Local = No
         Active = Yes
         Personal = Yes
NOTE: Action to LIST caslib CASUSER completed for session MYSESSION.
81   
82   proc casutil;
NOTE: The UUID '5fd75888-4c1a-c54b-9aba-f0539fe14771' is connected using session MYSESSION.
83   load file="&datadir./WorldData.xlsx" casout="myworlddata";
WARNING: Apparent symbolic reference DATADIR not resolved.
ERROR: Failed to open file '&datadir./WorldData.xlsx'.
84   contents casdata="myworlddata";
NOTE: The fileInfo action could not be run for the file "myworlddata".
ERROR: The table myworlddata could not be located in caslib CASUSER(myemail@gmail.com) of Cloud Analytic Services.
ERROR: The action stopped due to errors.
NOTE: Cloud Analytic Services processed the combined requests in 0.003561 seconds.
85   run;
86   
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE CASUTIL used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      
87   proc casutil;
NOTE: The UUID '5fd75888-4c1a-c54b-9aba-f0539fe14771' is connected using session MYSESSION.
88   load file="/Users/myemail@gmail.com/My Folder/WorldData.xlsx" casout="myworlddata";
ERROR: Failed to open file '/Users/myemail@gmail.com/My Folder/WorldData.xlsx'.
89   contents casdata="myworlddata";
NOTE: The fileInfo action could not be run for the file "myworlddata".
ERROR: The table myworlddata could not be located in caslib CASUSER(myemail@gmail.com) of Cloud Analytic Services.
ERROR: The action stopped due to errors.
NOTE: Cloud Analytic Services processed the combined requests in 0.002644 seconds.
90   run;
91   
92   
93   %studio_hide_wrapper;
101  
102  

 

4 REPLIES 4
CarmineVerrell
SAS Employee

Please take a look at your errors in the log, they are normally very descriptive and tell you why the code isn't working. 

Example

WARNING: Apparent symbolic reference DATADIR not resolved.
ERROR: Failed to open file '&datadir./WorldData.xlsx'

This is telling you that the macro variable datadir is not defined and the second line is telling you that it failed to find and open the file you are referencing.

You have a similar type of error with the second proc casutil.

jejobo2340
Fluorite | Level 6

I add the below statement at the beginning of my code which seems to me a correct way of defining macro variables, but it does not work anyways.

 

%LET datadir = /Users/myemail@gmail.com/My Folder ;

I guess the error you refer to as descriptive is the following: 

 

 Failed to open file '/Users/myemail@gmail.com/My Folder/WorldData.xlsx'.

Well for me seems like the path is not formated properly but as I show you in the screenshot the file is there.

jejobo2340_0-1638458909489.png

 

 

CarmineVerrell
SAS Employee

If your code or data is stored in the SAS Content/SAS Folder tree, then you can use the FILESRVC file access method.

 

See here for an example: https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=lestmtsglobal&docsetTa...

jejobo2340
Fluorite | Level 6

Thanks to your hint, I tried the following code and it seems working:

 

cas mySession sessopts=(caslib=casuser timeout=1800 locale="en_US");


filename fileref  filesrvc folderpath='/Users/myemail@gmail.com/My Folder/' filename='WorldData.xlsx';

 proc import datafile=fileref out=casuser.WorldData(promote=yes)
        dbms=XLSX ;
 run;

Another thing: strangely enough coping the file in the home directory, my code with casutil is working, here is the code:

 

proc casutil;
load file="/home/myemail@gmail.com/WorldData.xlsx" casout="myworlddata" replace;
contents casdata="myworlddata";
run;

So seems like there is something wrong with the visibility of Users/myemail@gmail.com/ to casutil. I am interested to know how to fix it.

 

The example I tried to run with casutil proc is found here on page 8: https://support.sas.com/content/dam/SAS/support/en/books/free-books/exploring-sas-viya.pdf

 

jejobo2340_0-1638460340625.png

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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