09-05-2013 04:38 PM
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).
09-05-2013 05:02 PM
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;
do i have to make any changes in my code?
09-05-2013 09:11 PM
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.
02-01-2018 04:40 PM