Wall, Steven wrote:
> I've had a macro for a long time that uses the 'X' command and the
> Windows 'mkdir' command to spawn out of a SAS session and create
> folders. Now, I'm using Enterprise Guide to access SAS on a server
> and get a warning that
> WARNING: Shell escape is not valid in this SAS session.
> Does anyone have a way around this? In other words, is there another
> way to create folders
> from within a SAS session without spawning out?
> Thanks for any suggestions you can give.
Shell escape is not valid is from startup option -NOXCMD.
This also means SYSTEM() and %SYSEXEC() are also not allowed.
However, the MODULEN() will still work.
filename sascbtbl catalog 'work.win.api.source';
arg 1 input char format=$cstr200.; * directory to create (cannot create
multiple levels in one call);
arg 2 input num format=ib4.; * security attributes, use 0;
work = pathname('work');
level1 = catx ('\', work, 'level1');
level2 = catx ('\', level1, 'level2');
put 'rc: 0 -> failure, 1-> success';
rc = modulen ('CreateDirectoryA', 'zz:\foobar', 0);
rc = modulen ('CreateDirectoryA', level1, 0);
rc = modulen ('CreateDirectoryA', level2, 0);
Find more SASCBTBL routine examples at
Another way would be to use a javaobj to create a directory.
*Note: File.mkdir() will only create one level at a time;
declare javaobj jfile ('java/io/File', 'c:\temp\newfolder2');
jfile.callBooleanMethod ('mkdir', rc);
put 'rc: 1->success, 0-> failure';
put 'NOTE: failure will occur when trying to create an existing folder';
I'm sure there are a few more, but I'll keep those secret ;-)
Richard A. DeVenezia