BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jj_mk
Calcite | Level 5

I need to be able to replicate some basic UNIX commands but work in an environment where the NOXCMD option is set and, therefore, cannot use X, call system or %sysexec in my SAS programs.

My requirement is to be able to move .XML and .txt files between UNIX directories and (potentially delete them), i.e. to replicate the mv and rm UNIX commands.  I've found several examples that use data step processing to copy files on a byte-by-byte basis so could use this as the first part of a 2 step move, but can find nothing that would delete the original source file after it had been copied. Apologies if I'm missing something obvious.  If this can't be done then I have shell scripts to do this but will have to somehow include them in my LSF Flow.

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20

try the external file functions, e.g. FDELETE. haven't tried then under NOXCMD, but the documentation doesn't mention that as a constraint.

A part from that NOXCMD are typically set for a reason, you should interfere with OS level operations.

If you have a requirement for this, convince the SAS admin to let you have this restriction removed.

There is (are several?) threads in the forum on this matter, use search.

Data never sleeps

View solution in original post

4 REPLIES 4
LinusH
Tourmaline | Level 20

try the external file functions, e.g. FDELETE. haven't tried then under NOXCMD, but the documentation doesn't mention that as a constraint.

A part from that NOXCMD are typically set for a reason, you should interfere with OS level operations.

If you have a requirement for this, convince the SAS admin to let you have this restriction removed.

There is (are several?) threads in the forum on this matter, use search.

Data never sleeps
Kurt_Bremser
Super User

On any well-maintained system, I see no need for the noxcmd restriction.

Moving files is a typical OS-level activity and should be done with OS tools (and shell escapes if done from within other software, eg SAS)

Aside from that, fdelete and the other file-related functions work even under the noxcmd restriction (just tested with fdelete()); which could make for some interesting communication if the SAS admin thinks himself safe behind the -noxcmd and you manage to delete a file that SHOULD NOT BE DELETED.

data_null__
Jade | Level 19

Have a look a new FCOPY function, new to SAS 9.4.  It looks to be able to replace data step for file copy.  I have not used it, no 9.4 for me.

jj_mk
Calcite | Level 5

Thanks guys. FCOPY plus FDELETE does the job - apologies that I'd not picked up on these before.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 804 views
  • 6 likes
  • 4 in conversation