5

I want to use a SAS function such as

proc datasets nolist;
    delete lib.temp_something lib.temp_something2 lib.temp_something3;
quit;

Is there a shortcut to delete all tables with the same prefix so I dont have to manually type them out?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
shecode
  • 1,716
  • 6
  • 32
  • 50

3 Answers3

9

Similar to @Dwal

proc datasets lib=lib nolist nowarn;
delete temp_somthing:;
run;
Lovnlust
  • 1,507
  • 3
  • 29
  • 53
3

I think the colon wildcard : should do what you want.

proc datasets nolist;
    delete lib.temp_something:;
quit;
DWal
  • 2,752
  • 10
  • 19
  • @neoman it does according to the documentation. It also works in set statements. You may need to move the lib to the proc datasets line, but I'm not sure about that. – Reeza Feb 24 '15 at 05:08
  • 1
    proc datasets lib=lib nolist; delete temp_something:; quit; @Reeza , yeah you are right, though this is the correct syntax. – in_user Feb 24 '15 at 05:33
  • very nice! was trying for ages with regex when this is much simpler. – Triamus Nov 16 '16 at 13:54
0

You could use something like this below

proc delete lib=mylib data = temp_something-temp_something3;
run;

http://support.sas.com/resources/papers/proceedings13/022-2013.pdf

in_user
  • 1,948
  • 1
  • 15
  • 22