data one;
input string $;
datalines;
apple
banana
coconut
;
data two;
input string $;
datalines;
anagram
bottle
clown
dog
;
data combo;
set one(in=o) two(in=t);
if o then origin='one';
else origin='two';
run;
proc print data=combo;
run;
其实这里用了IN这个参数来表示在SET过程中,观测对象的来源,根据IN参数的值来判断并赋予不同的值。
结果:
SAS 系统
Obs string origin
1 apple one
2 banana one
3 coconut one
4 anagram two
5 bottle two
6 clown two
7 dog two