1)I would need create one directory like 24042018(directory) by using X command
for example : 'x mkdir /data/file/data_folder';
when ever we run that code it will create current datefolder
2)Directories should maintain only week folders remaining folder should delete through sas program
Really appreciate your help on this
Why XCMD? Can you use DCREATE()? Or the LIBNAME trick with the DLCREATEDIR option enabled.
https://blogs.sas.com/content/sasdummy/2013/07/02/use-dlcreatedir-to-create-folders/
There's also FDELETE() to delete the folders you don't want.
Hi Thanks for your reply but we are using unix environment .All the folders are in unix boxes.that is why I am using X commands
but I would need create directory with current dateformat for example the if I execute the sas code today it should create folder like 24042018 in some directory
Really appreciate your help
Not sure why you still can't use DCREATE() or LIBNAME. This is the idea below.
data _null_;
path_to_folder = '/folders/myfolders/';
date_char = put(today, yymmdd10.);
folder_name = catx("_", 'folder', date_char);
y = dcreate(folder_name, path_to_folder);
run;
To check for the existence of the other folder you can use FEXIST and then FDELETE. You didn't specify how the naming is managed but it should be relatively straightforward if you have a structured process.
@Pavan4 wrote:
Hi Thanks for your reply but we are using unix environment .All the folders are in unix boxes.that is why I am using X commands
but I would need create directory with current dateformat for example the if I execute the sas code today it should create folder like 24042018 in some directory
Really appreciate your help
If you have to use X commands, you need to find the Unix commands which is best done on a unix forum, and then you pass them to the system using %SYSEXEC, CALL SYSTEM, or X statements.
In that case, I'd test the commands on the unix side first as well and then move the commands back to SAS after they're fully tested, otherwise you have more room for error.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.