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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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

6 REPLIES 6
Tom
Super User Tom
Super User

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;

KevinC_
Fluorite | Level 6

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'.

Tom
Super User Tom
Super User

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.

KevinC_
Fluorite | Level 6

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!

ballardw
Super User

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.

SASKiwi
PROC Star

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;

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
  • 6 replies
  • 2657 views
  • 0 likes
  • 4 in conversation