BookmarkSubscribeRSS Feed
LRN
Calcite | Level 5 LRN
Calcite | Level 5

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

Thanks in advance.

4 REPLIES 4
LinusH
Tourmaline | Level 20

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
LRN
Calcite | Level 5 LRN
Calcite | Level 5

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

PaulHomes
Rhodochrosite | Level 12

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.

DaveShea
Lapis Lazuli | Level 10
Paul,
I know that this is an old post, but referencing Chris Hemedinger's blog post was a great idea. For those who can use the DLCREATEDIR option at their site, this is a really useful facility.

Cheers,

Downunder Dave

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 4 replies
  • 2594 views
  • 1 like
  • 4 in conversation