Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro's creating folder on Export.

Status
Not open for further replies.

shenniko

Programmer
Apr 15, 2005
52
US
Hi all,

Need some help again,

I've a macro setup to export a series of CSV files for each region we have, and this report will be ran monthly. But what i would like it to do is export the CSV files to its own folder depenging on the Month/Year...

E.g Running this report now, it should create a dataset for each region we have, for last month.

So when exporting the CSV files, i'd like sas to create a folder called /November_2005/ and then export all the files to that directory.. Next month it will create a folder called /December_2005/ etc.. etc..

Any ideas on how i go about doing this?

thanks in advance

Robbie
 
If you are using a windows OS you could use he MD command. I would use the year first so that the folder sorts by default, but here is how you can do it.

Code:
%let rptroot =c:\path\to\root;

%let y= %sysfunc(putn(%sysfunc(date()),monname9.))_%sysfunc(putn(%sysfunc(date()),year4.));

filename outrpt pipe "md &rptroot\&y";

data _null_;
file outrpt;
run;

I hope that this helps you out.
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top