1 data mylearn.outerjoin_a;
 2     input a :$;
 3     datalines;
 4     a
 5     b
 6     c
 7     d
 8     e
 9     f
10     g
11     ;
12 run;
13 data mylearn.outjoin_b;
14     input b :$;
15     datalines;
16     b
17     c
18     d
19     k
20     ;
21 run;
22 proc sql;
23     select * from mylearn.outerjoin_a a right join mylearn.outjoin_b b
24     on a.a=b.b;
25 quit;
26 proc sql;
27     select * from mylearn.outerjoin_a a left join mylearn.outjoin_b b
28     on a.a=b.b;
29 quit;

left join 结果是【sas proc sql】out join_sql

1 proc sql;
2     select a.a '#a#a sample',b.b from mylearn.outerjoin_a a full join mylearn.outjoin_b b
3     on a.a=b.b;
4 quit;

注意:行说明中的# #是用来在label上换行