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

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
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

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

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 6772 views
  • 7 likes
  • 5 in conversation