Dear All,
Please can you help to provide how to create the Folders in SAS and Rename the folders using the code.
Many Thanks
Dhruva
@dhruvakumar wrote:
Dear KurtBremser,
Thanks for advice.If you don't mind can you help one example ...Thanks
The documentation for each function has examples. Is there something unclear about them?
DCREATE()
data one; /* To create a new directory in the UNIX operating environment, using the name that is stored in the variable DirectoryName, follow this form: */ NewDirectory=dcreate(DirectoryName, '/local/u/abcdef/'); /* To create a new directory in the Windows operating environment, using the name that is stored in the variable DirectoryName, follow this form: */ NewDirectory=dcreate(DirectoryName, 'd:\testdir\'); run;
RENAME()
Example 1: Renaming Data Sets and Catalog Entries
The following examples rename a SAS data set from Data1 to Data2, and also rename a catalog entry from A.SCL to B.SCL.
rc1=rename('mylib.data1', 'data2');
rc2=rename('mylib.mycat.a.scl', 'b', 'catalog');
Example 2: Renaming an External File
The following examples rename external files.
/* Rename a file that is located in another directory. */
rc=rename('/local/u/testdir/first',
'/local/u/second', 'file');
/* Rename a PC file. */
rc=rename('d:\temp', 'd:\testfile', 'file');
Example 3: Renaming a Directory
The following example renames a directory in the UNIX operating environment.
rc=rename('/local/u/testdir/', '/local/u/oldtestdir', 'file');
Example 4: Renaming a Generation Data Set
The following example renames the generation data set Work.One to Work.Two, where the password for Work.One#003 is my-password.
rc=rename('work.one', 'two',,, 3,'my-password');
I highly suggest bookmarking this page, it's a good organization of functions organized by category
If you are talking about folders (directories) in the file system, look at the dcreate() and rename() functions.
If you are talking about SAS metadata folders, look at the METADATA procedure, but using it is NOT trivial.
Dear KurtBremser,
Thanks for advice.If you don't mind can you help one example ...Thanks
@dhruvakumar wrote:
Dear KurtBremser,
Thanks for advice.If you don't mind can you help one example ...Thanks
The documentation for each function has examples. Is there something unclear about them?
DCREATE()
data one; /* To create a new directory in the UNIX operating environment, using the name that is stored in the variable DirectoryName, follow this form: */ NewDirectory=dcreate(DirectoryName, '/local/u/abcdef/'); /* To create a new directory in the Windows operating environment, using the name that is stored in the variable DirectoryName, follow this form: */ NewDirectory=dcreate(DirectoryName, 'd:\testdir\'); run;
RENAME()
Example 1: Renaming Data Sets and Catalog Entries
The following examples rename a SAS data set from Data1 to Data2, and also rename a catalog entry from A.SCL to B.SCL.
rc1=rename('mylib.data1', 'data2');
rc2=rename('mylib.mycat.a.scl', 'b', 'catalog');
Example 2: Renaming an External File
The following examples rename external files.
/* Rename a file that is located in another directory. */
rc=rename('/local/u/testdir/first',
'/local/u/second', 'file');
/* Rename a PC file. */
rc=rename('d:\temp', 'd:\testfile', 'file');
Example 3: Renaming a Directory
The following example renames a directory in the UNIX operating environment.
rc=rename('/local/u/testdir/', '/local/u/oldtestdir', 'file');
Example 4: Renaming a Generation Data Set
The following example renames the generation data set Work.One to Work.Two, where the password for Work.One#003 is my-password.
rc=rename('work.one', 'two',,, 3,'my-password');
I highly suggest bookmarking this page, it's a good organization of functions organized by category
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.