Chinaunix首页 | 论坛 | 博客
  • 博客访问: 408671
  • 博文数量: 119
  • 博客积分: 1470
  • 博客等级: 上尉
  • 技术积分: 1258
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-24 13:50
文章分类

全部博文(119)

文章存档

2018年(6)

2017年(11)

2016年(4)

2013年(8)

2012年(1)

2011年(2)

2010年(4)

2009年(37)

2008年(16)

2006年(30)

我的朋友

分类:

2009-09-02 18:50:38

Use the DELETE statement to delete one or more data sets from a SAS data library. If you want to delete more than one data set, then simply list the names after the DELETE keyword with a blank space between the names, or use an abbreviated member list if applicable (such as YRDATA1-YRDATA5).

CAUTION:
SAS immediately deletes the files in a SAS data library when the program statements are submitted.

You are not asked to verify the delete operation before it begins, so be sure that you intend to delete the files before submitting the program.  [cautionend]

For example, the following program specifies USCLIM as the procedure input library, then deletes the data set RAIN from the library:

proc datasets library=usclim;
delete rain;
run;

The following output shows that SAS sends messages to the SAS log when it processes the DELETE statement:

212  proc datasets library=usclim;
-----Directory-----

Libref: USCLIM
Engine: V8
Physical Name: external-file
File Name: external-file
Inode Number: 1864992
Access Permission: rwxr-xr-x
Owner Name: userid
File Size (bytes): 4096


File
# Name Memtype Size Last Modified
-------------------------------------------------
1 BASETEMP CATALOG 20480 15NOV2000:14:38:35
2 HIGHTEMP DATA 16384 16NOV2000:12:14:50
3 LOWTEMP DATA 16384 16NOV2000:12:14:54
4 RAIN DATA 16384 16NOV2000:12:14:59
5 REPORT CATALOG 20480 15NOV2000:14:39:02
6 TEMPCHNG DATA 16384 15NOV2000:14:30:41
7 USHIGH DATA 16384 15NOV2000:14:26:48
8 USLOW DATA 16384 15NOV2000:14:30:08
213 delete rain;
214 run;
NOTE: Deleting USCLIM.RAIN (memtype=DATA).

To delete all data sets but a few, you can use the SAVE statement to list the names of the data sets that you want to keep. List the data set names with a blank space between the names, or use an abbreviated member list (such as YRDATA1-YRDATA5) if applicable.

The following statements delete all the data sets except TEMPCHNG from the library USCLIM:

   save tempchng;
run;

The following output shows the SAS log from the delete operation. SAS sends messages to the SAS log, verifying that it has kept the data sets that you specified in the SAVE statement and deleted all other members of the library.

232     save tempchng;
233 run;
NOTE: Saving USCLIM.TEMPCHNG (memtype=DATA).
NOTE: Deleting USCLIM.BASETEMP (memtype=CATALOG).
NOTE: Deleting USCLIM.HIGHTEMP (memtype=DATA).
NOTE: Deleting USCLIM.LOWTEMP (memtype=DATA).
NOTE: Deleting USCLIM.REPORT (memtype=CATALOG).
NOTE: Deleting USCLIM.USHIGH (memtype=DATA).
NOTE: Deleting USCLIM.USLOW (memtype=DATA).
阅读(753) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~