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 All,

 

After I run a SAS program in UNIX the program can create a folder " /home/A123456ABC/XYZ/ABC"  for me. how to write the SAS code?

 

Thanks!

 

x123456789-aaa-15$ pwd
/home/A123456ABC/My_report
x123456789-aaa-16$  sas the_code_needed.sas

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

SAS doesn't have any special code to create a directory.  Instead, it lets you issue a Unix command.  For example, within a SAS program you could code:

 

%sysexec cd /home/A123456ABC;

%sysexec mkdir My_Reports_test1;

 

I can't test it right now, but you should test it when the program you submit is in your home folder, as well as when the program is in some other folder.

View solution in original post

5 REPLIES 5
Astounding
PROC Star

SAS doesn't have any special code to create a directory.  Instead, it lets you issue a Unix command.  For example, within a SAS program you could code:

 

%sysexec cd /home/A123456ABC;

%sysexec mkdir My_Reports_test1;

 

I can't test it right now, but you should test it when the program you submit is in your home folder, as well as when the program is in some other folder.

GeorgeSAS
Lapis Lazuli | Level 10

How to embed the unix command into SAS code? I want the SAS code be executed automation include creating new folder step.

Astounding
PROC Star

%sysexec is the SAS code.  It doesn't need to be embedded.  Just save it as a .sas file and run it.

boemskats
Lapis Lazuli | Level 10

Not strictly true. This can also be useful if you don't have xcmd permissions:

 

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002986745.htm

 

Ksharp
Super User

Check function  DCREATE() .

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 5199 views
  • 3 likes
  • 4 in conversation