From: Joe Matise on
Yep.

x "md <directory name>"; (and of course use whatever macro variable in that
you want).

Use OPTION NOXWAIT, also.

-Joe

On Tue, Sep 15, 2009 at 1:47 PM, Norris, Paul <Paul.Norris(a)ucsf.edu> wrote:

> I'd like to programmatically create a destination folder for jobs that
> appends the datetime to the name of the folder.
>
> Is it possible to create a folder in Windows from SAS and give it a name
> generated in the SAS program?
>
> Thanks,
>
> Paul Norris
> UCSF
>
From: Shankar on
It might be better to do this using the function DCREATE;

data _null_;

length test $32;

/* test can be a data set variable */

test=strip('test1_' !! put(today(),best.));

NewDirectory=dcreate(test,'/local/u/abcdef/');

run;

If directory could not be created then NewDirectory would be empty;
Please see documentation;

thanks,
Shankar
From: Adolfo Lopez on
Yes, the following command will create a directory using a macro variable.
You can define the variable in you SAS program prior to submitting this
line of code. FYI, this is submitted outside of the data step.


x mkdir &dirnam.;

Adolfo Lopez | Discover
Project Manager, Analysis & Pricing
2500 Lake Cook Road, Riverwoods, IL 60015
P: 224.405.5328 F: 224.405.4971 adolfolopez(a)discover.com



"Norris, Paul" <Paul.Norris(a)UCSF.EDU>
Sent by: "SAS(r) Discussion" <SAS-L(a)LISTSERV.UGA.EDU>
09/15/2009 01:54 PM
Please respond to
"Norris, Paul" <Paul.Norris(a)UCSF.EDU>


To
SAS-L(a)LISTSERV.UGA.EDU
cc

Subject
Possible to create a folder (in Windows) from SAS?






I'd like to programmatically create a destination folder for jobs that
appends the datetime to the name of the folder.

Is it possible to create a folder in Windows from SAS and give it a name
generated in the SAS program?

Thanks,

Paul Norris
UCSF




Please consider the environment before printing this email.
From: Nathaniel Wooding on
I have never used it but there is the V9 function

DCREATE (dirname,<pdir>) creates directory dirname under current working
directory or parent directory pdir; returns full pathname if
successful, null string if unscuccessful
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.
From: Kevin Viel on
On Tue, 15 Sep 2009 11:47:23 -0700, Norris, Paul <Paul.Norris(a)UCSF.EDU>
wrote:

>I'd like to programmatically create a destination folder for jobs that
>appends the datetime to the name of the folder.
>
>Is it possible to create a folder in Windows from SAS and give it a name
>generated in the SAS program?

Surely. In fact, I created an ugly macro for my Windows box:



%Macro DCreate ( Path = ) ;

Data _null_ ;

Length Path $ 500
Folder $ 100
;

Path = Scan( "&Path." , 1 , "\" ) ;

Do _n_ = 2 To CountC( "&Path." , "\" ) + 1 ;
Folder = Scan( "&Path." , _n_ , "\" ) ;
RC = DCreate( Folder , Path ) ;
Path = CatS( Path , "\" , Folder ) ;
If RC ne " " then put RC= ;
End ;

Run ;

%MEnd DCreate ;

HTH,

Kevin