y****t 发帖数: 446 | 1 我有两个datasets:
first dataset:
Name Response
A *
A *
B *
B *
B *
C *
C *
second dataset:
Name Response
A *
A *
A *
B *
C *
C *
C *
D *
D *
E *
我想subset第二个dataset,让它只留下第一个dataset出现的name的数据,也就是把第
二个dataset里的D和E对应的observations都去掉
请教大家 |
f*******e 发帖数: 51 | 2 proc sql noprint;
create table c as
select b.*
from secondfile as b
where name in
(select distinct name from firstfile as a);
quit;
【在 y****t 的大作中提到】 : 我有两个datasets: : first dataset: : Name Response : A * : A * : B * : B * : B * : C * : C *
|
y****t 发帖数: 446 | 3 谢谢。
但是结果table c里只有
A
A
A
而没有B C 的数据
【在 f*******e 的大作中提到】 : proc sql noprint; : create table c as : select b.* : from secondfile as b : where name in : (select distinct name from firstfile as a); : quit;
|
y****t 发帖数: 446 | 4 it works now!thank you!
【在 f*******e 的大作中提到】 : proc sql noprint; : create table c as : select b.* : from secondfile as b : where name in : (select distinct name from firstfile as a); : quit;
|
c*****m 发帖数: 4817 | 5 R
>subset(b, match(b$name, a$name)>0)
【在 y****t 的大作中提到】 : 我有两个datasets: : first dataset: : Name Response : A * : A * : B * : B * : B * : C * : C *
|