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)) ;

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 810 views
  • 2 likes
  • 3 in conversation