楼主: arnoldsw
7614 9

问个sas数据集索引的问题 [推广有奖]

  • 0关注
  • 0粉丝

大专生

21%

还不是VIP/贵宾

-

威望
0
论坛币
12 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
841 点
帖子
61
精华
0
在线时间
31 小时
注册时间
2008-6-6
最后登录
2020-5-25

楼主
arnoldsw 发表于 2010-1-4 10:06:27 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
有一个大表,曾经建过索引,现在索引坏了,无论做什么操作sas都要先为它重建索引,delete index的话也要先重建再删,但是目前的硬盘空间不足以重建索引,所以就会死在那里。

请问有没有办法不重建索引就能让sas把这个表恢复为无索引表?

注:表80G,建索引的临时空间要300G左右
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:sas数据集 数据集 delete Index 请问有没有 SAS 数据集 索引

回帖推荐

horace_chen 发表于8楼  查看完整内容

呵呵,查了SAS网站,发现9.1版本里面使用PROC DATASETS中REPAIR语句,或者使用System Option里面的"DLDMGACTION=repair",都会修复和重建索引。9.2版本中,PROC DATASETS多了一个rebuild语句,System Option里也多了一个"DLDMGACTION=NOINDEX ",只修复数据,不重建索引

本帖被以下文库推荐

沙发
bobguy 发表于 2010-1-4 10:54:22
arnoldsw 发表于 2010-1-4 10:06
有一个大表,曾经建过索引,现在索引坏了,无论做什么操作sas都要先为它重建索引,delete index的话也要先重建再删,但是目前的硬盘空间不足以重建索引,所以就会死在那里。

请问有没有办法不重建索引就能让sas把这个表恢复为无索引表?

注:表80G,建索引的临时空间要300G左右
You can use the rebuilt statement with noindex options in SAS unitility procedure "proc datasets" to rebuilt the data set.

Here is example with log files.

HTH
********************************

libname s 'c:\downloads';
data s.t2(index=(x) );
   do i=1 to 100;
     x=ceil(ranuni(12345)*5);
     output;
   end;
run;
proc datasets lib=s ;
quit;

option noxwait;
****delete the index with host command**;
data _null_;
cmd=  'del c:\downloads\t2.sas7bndx' ;
call  system(cmd);
run;

proc datasets lib=s ;
rebuild t2 /noindex;
quit;

proc datasets lib=s ;
quit;

*************************log**********************;

1466  libname s 'c:\downloads';
NOTE: Libref S was successfully assigned as follows:
      Engine:        V9
      Physical Name: c:\downloads
1467  data s.t2(index=(x) );
1468     do i=1 to 100;
1469       x=ceil(ranuni(12345)*5);
1470       output;
1471     end;
1472  run;

NOTE: The data set S.T2 has 100 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


1473  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
                         T2       INDEX      9216  03Jan10:21:49:39
1474  quit;

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


1475
1476  option noxwait;
1477  ****delete the index with host command**;
1478  data _null_;
1479  cmd=  'del c:\downloads\t2.sas7bndx' ;
1480  call  system(cmd);
1481  run;

NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.15 seconds


1482
1483  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
1484  rebuild t2 /noindex;
1485  quit;

NOTE: Rebuilding S.T2 (memtype=DATA).
NOTE: File S.T2.INDEX does not exist.
NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


1486
1487  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
1488  quit;

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds

藤椅
arnoldsw 发表于 2010-1-4 11:59:52
为啥我这里sas9.1没找到rebuild相关的东西?
proc datasets下面rebuild是红色字,帮助里面也没找到

板凳
arnoldsw 发表于 2010-1-4 16:07:35
有没有人知道哇

报纸
爱萌 发表于 2010-1-4 16:27:41
bobguy 发表于 2010-1-4 10:54
arnoldsw 发表于 2010-1-4 10:06
有一个大表,曾经建过索引,现在索引坏了,无论做什么操作sas都要先为它重建索引,delete index的话也要先重建再删,但是目前的硬盘空间不足以重建索引,所以就会死在那里。

请问有没有办法不重建索引就能让sas把这个表恢复为无索引表?

注:表80G,建索引的临时空间要300G左右
You can use the rebuilt statement with noindex options in SAS unitility procedure "proc datasets" to rebuilt the data set.

Here is example with log files.

HTH
********************************

libname s 'c:\downloads';
data s.t2(index=(x) );
   do i=1 to 100;
     x=ceil(ranuni(12345)*5);
     output;
   end;
run;
proc datasets lib=s ;
quit;

option noxwait;
****delete the index with host command**;
data _null_;
cmd=  'del c:\downloads\t2.sas7bndx' ;
call  system(cmd);
run;

proc datasets lib=s ;
rebuild t2 /noindex;
quit;

proc datasets lib=s ;
quit;

*************************log**********************;

1466  libname s 'c:\downloads';
NOTE: Libref S was successfully assigned as follows:
      Engine:        V9
      Physical Name: c:\downloads
1467  data s.t2(index=(x) );
1468     do i=1 to 100;
1469       x=ceil(ranuni(12345)*5);
1470       output;
1471     end;
1472  run;

NOTE: The data set S.T2 has 100 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


1473  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
                         T2       INDEX      9216  03Jan10:21:49:39
1474  quit;

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


1475
1476  option noxwait;
1477  ****delete the index with host command**;
1478  data _null_;
1479  cmd=  'del c:\downloads\t2.sas7bndx' ;
1480  call  system(cmd);
1481  run;

NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.15 seconds


1482
1483  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
1484  rebuild t2 /noindex;
1485  quit;

NOTE: Rebuilding S.T2 (memtype=DATA).
NOTE: File S.T2.INDEX does not exist.
NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


1486
1487  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
1488  quit;

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds
学习了
最恨对我说谎或欺骗我的人

地板
horace_chen 发表于 2010-1-4 16:53:23
2楼好像用的是SAS 9.2,在SAS 9.1中,proc datasets里面有REPAIR语句可以修复索引

SAS HELP
The most common situations that require the REPAIR statement are as follows:
   2、The device on which a SAS data set or an associated index resides is damaged. In this case, you can restore the damaged data set or index from a backup device, but the data set and index no longer match.

可以把
proc datasets lib=s ;
rebuild t2 /noindex;
quit;
改为
proc datasets lib=s ;
repair t2;
quit;

7
arnoldsw 发表于 2010-1-4 17:28:23
repair我试过好像,那个是重建索引。我不想重建,硬盘装不下

8
horace_chen 发表于 2010-1-5 10:29:34
呵呵,查了SAS网站,发现9.1版本里面使用PROC DATASETS中REPAIR语句,或者使用System Option里面的"DLDMGACTION=repair",都会修复和重建索引。9.2版本中,PROC DATASETS多了一个rebuild语句,System Option里也多了一个"DLDMGACTION=NOINDEX ",只修复数据,不重建索引
已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

9
bobguy 发表于 2010-1-5 11:42:52
horace_chen 发表于 2010-1-5 10:29
呵呵,查了SAS网站,发现9.1版本里面使用PROC DATASETS中REPAIR语句,或者使用System Option里面的"DLDMGACTION=repair",都会修复和重建索引。9.2版本中,PROC DATASETS多了一个rebuild语句,System Option里也多了一个"DLDMGACTION=NOINDEX ",只修复数据,不重建索引
You are absolutely right. Probably there is no chioce but to have SAS representive give you SAS 9.2 in this case.

Sorry I did not  say explicitly that it was working in SAS 9.2.

HTH

10
hykking 发表于 2013-5-5 17:02:59
学习了

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 13:17