全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
5803 6
2011-04-05
如题,我在sas中操作出现了如下错误:
第一种尝试:
proc sql;

delete

from peter.myworld

where _n_=7;
quit;



136  proc sql;
137      delete
138      from peter.myworld
139      where _n_=7;
ERROR: The following columns were not found in the contributing tables: _n_.
140  quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


第二种尝试:
proc sql;

delete

from peter.myworld

where noobs=7;
quit;


141  proc sql;
142      delete
143      from peter.myworld
144      where noobs=7;
ERROR: The following columns were not found in the contributing tables: noobs.
145  quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
还有一个小疑惑就是,sas怎么会说找不到columns?
二维码

扫码加我 拉你入群

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

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

全部回复
2011-4-6 09:22:08
1# peter

data sample;
   set peter.myworld;
   id=_n_;
run;
proc sql;
  delete from sample
  where id=7;
quit;
二维码

扫码加我 拉你入群

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

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

2011-4-6 09:35:41
复制代码
直接用if语句不就可以实现你的目的嘛
二维码

扫码加我 拉你入群

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

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

2011-4-6 21:51:42
yugao1986 发表于 2011-4-6 09:22
1# peter

data sample;
   set peter.myworld;
   id=_n_;
run;
proc sql;
  delete from sample
  where id=7;
quit;
感谢回复!你这个方法是复制一个原数据集,然后删去复制数据集中的观测吧?这个对原数据集是没有影响的吧?
如果我想直接删去原数据集中的变量,该怎么办?
我将你后面的命令直接用到原数据集上,还是不行。

proc sql;

delete

from peter.myworld

where id=10;
quit;


sas的log:
26   proc sql;
27       delete
28       from peter.myworld
29       where id=10;
ERROR: The following columns were not found in the contributing tables: id.
30   quit;
二维码

扫码加我 拉你入群

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

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

2011-4-6 21:52:38
3# leedx 谢谢!
请问若想用sql过程实现,该如何操作?
二维码

扫码加我 拉你入群

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

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

2011-4-6 22:09:51
4# peter
保持原数据的完整。你可以在修改过的数据中将id去掉就可以了,就等价在原数据修改了。
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群