BookmarkSubscribeRSS Feed
sunilreddy
Fluorite | Level 6

I am using below code to delet the file from below path, but its dleteing the file from the specified path and getting return code is 20029
data _null_;
rc1=filename("x","/opt/app/SAS/test/1.bin"); 
rc2=fdelete("x"); 
rc3=filename("x",""); 
put rc1= rc2= rc3=;   
run;
output:
rc1=0 rc2=20029 rc3=0 ;   


Using SAS 9.2. Can  any one help me in this

2 REPLIES 2
BobD
Fluorite | Level 6

Well, either the file /opp/app/SAS/test/1.bin does not exist or the UNIX account from where you are running SAS does not have permission to delete the file.

The FILENAME function just defines a "fileref"; the file itself does not have to already exist.

Also, as an experiment, see if you can create a file and then delete it using the SYSTEM function to execute a plain old UNIX commands:

rc = system('touch /opt/app/SAS/test/foo'); /* Create an empty file */

put 'Created file foo' rc=;

rc = system('rm /opt/app/SAS/test/foo');

put 'Deleted file foo' rc=;

That might lead you to a solution.

shivas
Pyrite | Level 9

Hi Sunil,

Try this...it worked for me in window environment.

FILENAME test "F:\Test\tes.xlsx"  ;

  DATA _NULL_ ;

    rc = FDELETE('test') ;

  put rc=;

  RUN ;

Thanks,

Shiva

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 3264 views
  • 0 likes
  • 3 in conversation