Hi I am trying to create a directory in Unix using sas EG. I need help..
Thanks in advance.
Assuming that you mean programmatically.
First, if you are connected to a Remote Host, make sure that the workspace server is started in such manner that allows you to do stuff "outside" SAS (ALLOWXCMD).
Then you could either use OS commands for this, which you can call by CALL SYSTEM, or the X-statement.
There are also a variety of function calls that handles external files (DCREATE for instance).
Hi,
How to make sure the workspace server is started in such a way that allows to do stuff "outside" SAS (ALLOWXGMD)?
I used the following:
%if %sysfunc(fexist(/aaa/bbb/ccc/&yymm.)) eq 0 %then %do;
x mkdir /aaa/bbb/ccc/&yymm./work;
%end;
do i have to make any changes in my code?
Thank you
As Linus mentions, if you want to use call system or x then you may need to talk to your administrator about enabling operating system commands for workspace server sessions (the default is they are disabled). I wrote a blog post about this a while back: NOXCMD: NO eXternal CoMmanDs! - platformadmin.com. There's lots of handy links in the post and in the comments.
If you use the DCREATE function instead then you won't need to get the admin to open up xcmd access - easier for both of you.
If you are using SAS 9.3 or above then I suggest you also take a look at Chris Hemedinger's blog post: SAS trick: get the LIBNAME statement to create folders for you - The SAS Dummy. It's a neat new hassle-free technique for creating dirs.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.