BookmarkSubscribeRSS Feed
hanssen
Fluorite | Level 6

 

%let folder_name = 'foldeCBA'; 
%let path = '/home/u47498320/SAS Projects/folder1'; 

data null;
 new=dcreate(&folder_name, &path);
run;

I am trying to run this code in SAS Viya, it has no errors/ warnings but did not manage to create a new folder named foldeCBA. This works fine in SAS Studio. I suspect its due to how the data are stored/ location in SAS Viya. Any ideas on this? 

 

6 REPLIES 6
gwootton
SAS Super FREQ
Which version of Viya? The DCREATE documentation indicates you need to pull SYSMSG to see the failure reason. For example:
%let folder_name = 'foldeCBA';
%let path = '/home/u47498320/SAS Projects/folder1';
data _null_;
new=dcreate(&folder_name,&path);
msg=sysmsg();
put msg=;
run;

DCREATE Function
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1aj29pf4cxnirn15q5hmf0tv43...
SYSMSG Function
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p08jvlsdb0wuu1n15jm7tvhg0yh...
--
Greg Wootton | Principal Systems Technical Support Engineer
hanssen
Fluorite | Level 6
msg=ERROR: Physical file does not exist, /home/u47498320/SAS Projects/folder1

My SAS version is V.03.05M0P11112019 and I got this message. I was wondering how could I check and go into the correct file path in SAS Viya so that I could create the folder? 

gwootton
SAS Super FREQ
The error message is saying the path where you are trying to create the folder doesn't exist. In SAS Studio in Viya 3.5 you may have the full system root available or it may start at your home directory. You could also sign on to the compute server host directly to identify the path.
--
Greg Wootton | Principal Systems Technical Support Engineer
hanssen
Fluorite | Level 6

Thanks @gwootton. Just curious, do you have any ideas on SAS commands that could get the current directory? I would like to try using SAS commands instead of logging into the server

gwootton
SAS Super FREQ
You could use these commands to get your home directory and the current working directory from environment variables:

%put %SYSGET(HOME);
%put %SYSGET(PWD);
--
Greg Wootton | Principal Systems Technical Support Engineer
hanssen
Fluorite | Level 6

I am still unable to resolve finding the correct folder path. However, I have decided to go with Macro Core library and it works fine for my problem. 

 

filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;

%mv_createfolder(path=/Users/ch/My Folder/TestFolder)