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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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