How to create unix directory using sas EG

Reply
Contributor LRN
Contributor
Posts: 57

How to create unix directory using sas EG

Hi I am trying to create a directory in Unix using sas EG. I need help..

Thanks in advance.

Super User
Posts: 5,437

Re: How to create unix directory using sas EG

Assuming that you mean programmatically.

First, if you are connected to a Remote Host, make sure that the workspace server is started in such manner that allows you to do stuff  "outside" SAS (ALLOWXCMD).

Then you could either use OS commands for this, which you can call by CALL SYSTEM, or the X-statement.

There are also a variety of function calls that handles external files (DCREATE for instance).

Data never sleeps
Contributor LRN
Contributor
Posts: 57

Re: How to create unix directory using sas EG

Hi,

How to make sure the workspace server is started in such a way that allows to do stuff "outside" SAS (ALLOWXGMD)?

I used the following:

%if %sysfunc(fexist(/aaa/bbb/ccc/&yymm.)) eq 0 %then %do;

x mkdir /aaa/bbb/ccc/&yymm./work;

%end;

do i have to make any changes in my code?

Thank you

PROC Star
Posts: 426

Re: How to create unix directory using sas EG

As Linus mentions, if you want to use call system or x then you may need to talk to your administrator about enabling operating system commands for workspace server sessions (the default is they are disabled). I wrote a blog post about this a while back: NOXCMD: NO eXternal CoMmanDs! - platformadmin.com. There's lots of handy links in the post and in the comments.

If you use the DCREATE function instead then you won't need to get the admin to open up xcmd access - easier for both of you.

If you are using SAS 9.3 or above then I suggest you also take a look at Chris Hemedinger's blog post: SAS trick: get the LIBNAME statement to create folders for you - The SAS Dummy. It's a neat new hassle-free technique for creating dirs.

Ask a Question
Discussion stats
  • 3 replies
  • 1010 views
  • 0 likes
  • 3 in conversation