DATA Step, Macro, Functions and more

X command in PC SAS

Accepted Solution Solved
Reply
Regular Contributor
Posts: 173
Accepted Solution

X command in PC SAS

Hello Everyone,

I am trying to remove a permanent SAS dataset stored in a Unix directory from PC SAS.  I enclose the code in Rsubmit and Endrsubmit;  For testing purpose, I try to remove just one file first.  When I run the code it has no errors.  But it does not remove the dataset either.  Can anyone tell me what I am doing wrong?  Thank you very much for any input you may have!

rsubmit;

%macro remove;

     x "rm /users/apps/cust_folder/customers1.sas7bdat";

%mend;

endrsubmit;

rsubmit;

%remove;

endrsubmit;


Accepted Solutions
Solution
‎02-18-2015 01:52 PM
Super User
Super User
Posts: 6,502

Re: X command in PC SAS

Sounds like your remote session is confused. Otherwise you should see the data step in the log with attendant NOTE: lines.

Try closing it and opening a new one.

View solution in original post


All Replies
Super User
Super User
Posts: 6,502

Re: X command in PC SAS

Your title is a little misleading.  Looks like you want to run a Unix command using RSUBMIT block to a remote SAS session.  Doesn't look like PC SAS has anything to do with it.

I usually like to use INFILE ... PIPE in a data step for those types of commands. That way you can see the response from the operating system.  Also not sure what the macro is there for.

rsubmit;

data _null_;

  infile "rm /users/apps/cust_folder/customers1.sas7bdat" pipe ;

   input;

   put _infile_;

run;

endrsubmit;

Regular Contributor
Posts: 173

Re: X command in PC SAS

Thanks Tom,

I ran your code and it did not display anything from _infile_.  There was no errors in the log.  In fact, the only thing I see in the log was "Remote submit to XXX commencing" and "Remote submit to xxx complete".  Any other suggestions?

Just to make myself clear, I run this from PC (Not on Unix). Hence, I call it 'PC SAS'.

Solution
‎02-18-2015 01:52 PM
Super User
Super User
Posts: 6,502

Re: X command in PC SAS

Sounds like your remote session is confused. Otherwise you should see the data step in the log with attendant NOTE: lines.

Try closing it and opening a new one.

Regular Contributor
Posts: 173

Re: X command in PC SAS

Thank you Tom, ballardw, and  SASKiwi.

Tom,

I restarted a new SAS session and now I was able to see more info in the log.  The problem was one of the letters in the file name had an incorrect case.  It works like a charm now.

Thank you everyone!

Super User
Posts: 10,550

Re: X command in PC SAS

Is that location available as a library from your SAS server or directly from your computer?

If so there is no reason to go to system commands. You could use proc delete or proc datasets.

And remember that UnIx is veRy Case sensiTIVE.

Super User
Posts: 3,115

Re: X command in PC SAS

Is there any particular reason for using an operating system command instead of these SAS techniques?

proc datasets library = MyLib;

  delete customers1;

  run;

quit;

or

proc sql;

  drop table Mylib.customers1;

quit;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 292 views
  • 0 likes
  • 4 in conversation