全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1323 1
2016-07-27
悬赏 100 个论坛币 已解决
data test;
input x y;
cards;
1 .
2 .
3 4
4 .
5 1
6 4
7 3
;
run;


   请问如何才能保存两个x=4的那个观测   因为 被指向了两次。  而且两个3的观测  因为一次是因为有数值 一次是被指向了

最佳答案

wwang111 查看完整内容

这样能解决你的问题吗? proc sql; create table step1 as select * from test where y ne . or x in (select y from test where y ne .); quit; data fmt; set step1; retain fmtname "point"; rename x=start y=label; run; proc format cntlin=fmt; run; data step2; set step1(keep=y); where y ne .; x=input(put(y,point.),best.); rename y=x x=y; run; proc sort data=step2; by ...
二维码

扫码加我 拉你入群

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

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

全部回复
2016-7-27 23:14:47
这样能解决你的问题吗?

proc sql;
create table step1 as
select * from test
where y ne . or x in (select y from test where y ne .);
quit;

data fmt;
set step1;
retain fmtname "point";
rename x=start y=label;
run;

proc format cntlin=fmt;
run;

data step2;
set step1(keep=y);
where y ne .;
x=input(put(y,point.),best.);
rename y=x x=y;
run;

proc sort data=step2;
by x y;
run;

data step3;
set step2;
by x y;
if first.x=1 and last.x=1 and y=. then delete;
if first.x and y=. then delete;
run;

data wanted;
set step1 step3;
run;

proc sort data=wanted;
by x;
run;
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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