BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dheaney
Calcite | Level 5

I am trying to delete a file and it had created a copy of itself in my library and my data. I am unable to delete it because it says "INVALID PHYSICAL NAME"

1 ACCEPTED SOLUTION

Accepted Solutions
JackieJ_SAS
SAS Employee

OK. Here is the original code: 

libname mylib "~/MyFolder";

proc datasets library=mylib kill;
run; quit;

The part you want to change is what is in quotes:

"~/MyFolder";

On SODA, your Files(Home) is your root directory, and you can call that with:

"~/"

I see you want to delete datasets from two subfolders-- MyData and MyLibrary.

So run the code once like this:

libname mylib "~/MyData";

proc datasets library=mylib kill;
run; quit;

Then run it again like this:

libname mylib "~/MyLibrary";

proc datasets library=mylib kill;
run; quit;

Make sense?

View solution in original post

31 REPLIES 31
Tom
Super User Tom
Super User

@dheaney wrote:

I am trying to delete a file and it had created a copy of itself in my library and my data. I am unable to delete it because it says "INVALID PHYSICAL NAME"


How are you trying to delete it? 

 

Did you run code?  Show the code and the log from the execution of the code.

Did you use some interactive feature?  What interactive tool are you using?  What action did you take (what menu did you use)?

tom_grant
SAS Super FREQ
Can you post a screenshot of the file in the directory?
tom_grant
SAS Super FREQ
You should be able to find the file on the Server Files and Folders tab (in one of your subfolders under Files(Home)) & then just right-click -> Delete.
dheaney
Calcite | Level 5
It won't allow me to delete it
dheaney
Calcite | Level 5
I get a pop up:
Invalid physical name
tom_grant
SAS Super FREQ
Can you post a screenshot of the file in your Server Files and Folders tab?
dheaney
Calcite | Level 5

I would like to delete the following: 

  • MyData
    • student_performance_factors2.sas7bdat 
    • Student_performance_factors2.sas7bdat
  • My Library
    • student_performance_factors2.sas7bdat

JackieJ_SAS
SAS Employee
Hi,

Try the PROC DATASETS code in the solution of this other post:

https://communities.sas.com/t5/SAS-Software-for-Learning/Deleting-Files-in-SAS-Studio-SAS-on-Demand-...

The code deletes all the datasets in a library. PROC datasets allows you to delete individual datasets as well, but that may not work given the problem you are having with the filename. I suggest you copy any datasets you want to keep to another folder, then delete all the datasets in the folder that contains the datasets you want to delete.
JackieJ_SAS
SAS Employee
By the way- I think the issue here is the mixed casing in the dataset names. I think SAS is expecting dataset names in all lower case. If you create a dataset using code within SODA, it will always have a name in all lowercase, but you may have imported a file with mixed case.
dheaney
Calcite | Level 5
HI Jackie,
I tried to do that and got the following.
WARNING: Library MYLIB does not exist.
ERROR: Library MYLIB does not exist.
Devon
JackieJ_SAS
SAS Employee

That error is telling you that you aren't pointing to the correct folder. Make sure to change the folder path in the code to the folder where the files are.

dheaney
Calcite | Level 5
I do not know what to change
JackieJ_SAS
SAS Employee

OK. Here is the original code: 

libname mylib "~/MyFolder";

proc datasets library=mylib kill;
run; quit;

The part you want to change is what is in quotes:

"~/MyFolder";

On SODA, your Files(Home) is your root directory, and you can call that with:

"~/"

I see you want to delete datasets from two subfolders-- MyData and MyLibrary.

So run the code once like this:

libname mylib "~/MyData";

proc datasets library=mylib kill;
run; quit;

Then run it again like this:

libname mylib "~/MyLibrary";

proc datasets library=mylib kill;
run; quit;

Make sense?

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 31 replies
  • 1348 views
  • 0 likes
  • 4 in conversation