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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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