BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Nasser_DRMCP
Lapis Lazuli | Level 10

hello

data HAVE ;
x=1;
run ;

%let mv_id_table = %sysfunc(open(work.HAVE)); 

proc datasets library=WORK memtype=data nolist;
delete HAVE ;
quit ;

by executing this code, the note is "File WORK.HAVE (memtype=DATA) cannot be deleted because it is in use."

how could I close the HAVE table ?

thanks in advance for your help

regards

Nasser

1 ACCEPTED SOLUTION

Accepted Solutions
SASJedi
Ammonite | Level 13

Close the file before attempting to delete it:

%let rc= %sysfunc(close(&mv_id_table )); 
Check out my Jedi SAS Tricks for SAS Users

View solution in original post

2 REPLIES 2
SASJedi
Ammonite | Level 13

Close the file before attempting to delete it:

%let rc= %sysfunc(close(&mv_id_table )); 
Check out my Jedi SAS Tricks for SAS Users
Tom
Super User Tom
Super User

When you open a DATASET (as opposed some generic FILE) with the OPEN() function it returns a reference to that dataset.  So to close it you pass that reference back to the CLOSE() function.

%let rc=%sysfunc(close(&mv_id_table)) ;