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

Hello

I want to see a code that delete a data set if the data set exists.

When I run the following code for a data set that doesn't exist then I get warning. 

WARNING: File work.XX.DATA does not exist.

 

proc delete data=XX;Run;

 

1 ACCEPTED SOLUTION
4 REPLIES 4
Ksharp
Super User
Write some dummy code before PROC DELETE ?

data xx;xx=1;run;
proc delete data=XX;Run;
ballardw
Super User

Proc datasets with the NOWARN and NODETAILS options.

AllanBowe
Barite | Level 11
The following macro can be used to remove multiple tables without warnings if they don't exist, it will also work just the same for views (so you don't need to test for that either):

https://core.sasjs.io/mp__dropmembers_8sas.html

/Allan
MacroCore library for app developers
Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 7663 views
  • 7 likes
  • 5 in conversation