|Date: ||Thu, 16 Mar 2000 07:39:45 GMT|
|Reply-To: ||Kimberly-Clark <ben.kentzer@KCC.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Kimberly-Clark <ben.kentzer@KCC.COM>|
|Subject: ||Re: %sysexec to winnt|
Thinking about this on a slightly more lateral tack...
We use an API called CreateDirectoryA (routine statement pasted below).
This certainly works on Win 95, and in the API book I have it suggests that
this should work on NT as well. It could be workth a try. We have a method
which calls this over and over again to create the require set of "offline"
directories for our system. In fact, I've just managed to get the code
working on NT!
Anyway, the routine statement is:
MINARG = 2
MAXARG = 2
STACKPOP = CALLED
MODULE = KERNEL32
RETURNS = SHORT;
ARG 1 CHAR FORMAT=$CSTR200. ;
ARG 2 NUM FORMAT=IB4. ;
and to call this in a data step, the code is:
data _null_ ;
xxx = modulen('CreateDirectoryA','e:\bensnewdirectory',0) ;
The xxx is a return code, and is meant to be 0 when successful. However, in
my experience it's either 0 or 1 - try it! the final parameter is the
security attributes for the directory. However, if you use 0, it sets the
folder up with "everyone" access. I guess this is not a problem?
If you're not familiar with API and MODULEN, check out the SAS Companion to
MS Windows - there's a good section in there. Basically though, all you
need to do is place the above routine statement in a file, which you then
set up a "filename" statement for, with a fileref of SASCBTBL.
I hope this helps!
DonMayfield <DonMayfield@excite.com> wrote in article
> I am trying to make directories from a sas program in winnt.
> I get this message from line 192 and the following lines don't work
> either. When I enter the command from the dos window they work.
> What am I doing wrong?
> The filename, directory name, or volume label syntax is incorrect.
> 189 options noovp nocenter macrogen symbolgen xwait;
> 190 %macro mkdir;
> 191 %sysexec;
> 192 %sysexec 'p:';
> 193 %sysexec 'cd \ccc\don\mdutil';
> 194 %sysexec 'mdir test1';
> 195 %mend mkdir;
> 196 %mkdir;
> Eventually I want to code a program to build an entire directory
> structure to run each quarter. It's to be table driven.
> posted by Don Mayfield
> Sent via Deja.com http://www.deja.com/
> Before you buy.