BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GeorgeSAS
Lapis Lazuli | Level 10

Hello everyone,

I want to create a sub-folder under WORK folder(temp folder),how to write SAS code to do this?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

You can use the "new" DLCREATEDIR option and the PATHNAME function.  If you want a FILEREF use PATHNAME again in a FILENAME statement.

options DLCREATEDIR=1;
libname FT51F001 "%sysfunc(pathname(work,L))/subfolderinwork";

View solution in original post

4 REPLIES 4
Astounding
PROC Star

Creating a subfolder requires using an operating system command.  So the method will vary from operating system to operating system.  SAS has methods that allow you to issue an operating system command, so this will be possible.  The key question boils down to this:

Suppose you knew the folder that holds the WORK library.  (SAS can retrieve that path.)  We'll call that "WORK library folder".  What operating system command would you issue to create the proper subfolder?


Reeza
Super User

dcreate() function

Kurt_Bremser
Super User

%let newdir=my_new_subdir;

data _null_;

length command x $ 300;

x = pathname('work');

command = 'mkdir '!!trim(x)!!"/&newdir";

call system(command);

run;

data_null__
Jade | Level 19

You can use the "new" DLCREATEDIR option and the PATHNAME function.  If you want a FILEREF use PATHNAME again in a FILENAME statement.

options DLCREATEDIR=1;
libname FT51F001 "%sysfunc(pathname(work,L))/subfolderinwork";

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3802 views
  • 3 likes
  • 5 in conversation