|
Will this run "entirely" in the background? Running command shells from
within AF/FRAME has that annoying property of the DOS window popping up for
a few microseconds (depending on your system). From an aesthetic
point-of-view that's a total turn-off after you've spent time designing a
pleasing interface.
Raymond
> -----Original Message-----
> From: Robert Mengis [SMTP:rmengis@BCO.COM]
> Sent: Tuesday, November 10, 1998 1:11 PM
> To: SAS-L@UGA.CC.UGA.EDU
> Subject: Re: SASMethod: Creating a directory structure, if required
>
> Aagh,
>
> Don't futz with the "dos" command, call the "c" function as below--much
> cleaner invocation:
>
> rc=filename('chkdir','c:\data');
> if ~fexist('chkdir') then do;
> submit continue; /*make sure directory is there*/
> filename sascbtbl 'j:\mkdb\winapi.txt';
> data _null_;
> rc=modulen('*e','CreateDirectoryA',
> 'c:\data',0);
> put 'directory created =1' rc=;
> run;
> endsubmit;
> end;
> Where "sascbtbl" contains the following text:
> routine CreateDirectoryA
> module=KERNEL32
> stackpop=called
> returns=long
> minarg=2
> maxarg=2;
> arg 1 input char format=$cstr200.;
> arg 2 input num format=ib4.;
> -----Original Message-----
> From: King, Raymond <raymondk@MOCR.OAPI.COM>
> Newsgroups: bit.listserv.sas-l
> To: SAS-L@UGA.CC.UGA.EDU <SAS-L@UGA.CC.UGA.EDU>
> Date: Tuesday, November 10, 1998 6:10 AM
> Subject: Re: SASMethod: Creating a directory structure, if required
>
>
> >Have you tried doing this on the "command level". That is: shell out to
> DOS
> >with a 'call system(command)' command and use the DOS "exist" command
> >
> >YOURLABEL:
> > submit continue;
> > OPTIONS NOXWAIT;
> > data _null_;
> > command="if NOT exist c:\xxx\yyy MD c:\xxx\yyy";
> > call system(command);
> > run;
> > endsubmit;
> >return;
> >
> >
> >My only concern is that Win98 might not let you create a multilevel
> >subdirectory with one command. Win95 did not. I've used this method
> >successfully on NT4.0.
> >
> >The data step should also work from BASE SAS.
> >
> >++++++++++++++++++++++++++++++++
> >Raymond King
> >Otsuka America Pharmaceutical, Inc.
> >2440 Research Boulevard
> >Rockville, MD 20850
> >301.527.4755
> >++++++++++++++++++++++++++++++++
> >
> >
> >> -----Original Message-----
> >> From: Phil Mason [SMTP:phil@WOODST.SURFAID.ORG]
> >> Sent: Tuesday, November 10, 1998 6:09 AM
> >> To: SAS-L@UGA.CC.UGA.EDU
> >> Subject: SASMethod: Creating a directory structure, if required
> >>
> >> The following refers to some code written in Screen Control Language
> which
> >> is part of the SAS/AF product, using SAS 6.12 on a Windows 98 platform.
> >>
> >> ----------
> >>
> >> Here is a method I wrote which might be of use to others. It checks to
> see
> >> if a directory structure exists. If it does, it does nothing. If it
> does
> >> not, then it creates the structure specified.
> >>
> >> I expect it could also be coded in macro language using %SYSFUNC
> >> functionality, if anyone requires to use it from BASE SAS - though of
> >> course
> >> you can call non-visual methods like this from BASE SAS (even in batch)
> by
> >> using PROC DISPLAY (though not on a server linked via SAS/Connect, only
> >> locally).
> >>
> >>
> >> ===> Example Code to call method.
> >>
> >> init:
> >> call method('catalog.main.methods.scl','test_dir','c:\xxx\yyy\zzz') ;
> >> return ;
> >>
> >>
> >> ===> Method
> >> *** This code will allocate a directory if it exists, and if it does
> >> not exist then it will create it ;
> >> test_dir:
> >> method dir $ 200 ;
> >> rc=filename('fexist',dir) ;
> >> msg=sysmsg() ;
> >> put rc= msg= ;
> >> fexist=fexist('fexist') ;
> >> msg=sysmsg() ;
> >> put fexist= msg= ;
> >> i=1 ;
> >> if ^fexist then
> >> do ;
> >> * Get directory prefix ;
> >> dir1=reverse(substr(reverse(dir),index(reverse(dir),'\'))) ;
> >> * Drop slash off end ;
> >> dir1=reverse(substr(reverse(dir1),2)) ;
> >> * If we have more subdirectories then check out if they need
> creating
> >> ;
> >> if length(dir1)>3 then
> >> call method('catalog.main.methods.scl','test_dir',dir1) ;
> >> rc=system('cd '||trim(dir1)||'\') ;
> >> msg=sysmsg() ;
> >> put i= rc= msg= dir1= ;
> >> dir2=reverse(substr(reverse(dir),1,index(reverse(dir),'\')-1)) ;
> >> rc=system('md '||dir2) ;
> >> msg=sysmsg() ;
> >> put i= rc= msg= dir2= ;
> >> end ;
> >> rc=filename('fexist',' ') ;
> >> return ;
> >> endmethod ;
> >>
> >>
> >>
> >> Philip Mason
> >> SAS Consultant, Wood Street Consulting
> >> 16 Wood Street, Wallingford, Oxfordshire, OX10 0AY, England
> >> Phone/Fax: (01491) 834615, GSM: (0411) 260990
> >> Email: phil@woodst.surfaid.org
> >> URL: www.users.surfaid.org/~woodst
|