2013年3月5日

【sas proc sql】子查询

摘要: 1 proc sql feedback;2 select * from merge_a3 where flight>(select max(flight) from merge_b);4 quit;1 proc sql feedback;2 select * from merge_a3 where flight in (select flight from merge_b);4 quit;-----correlated subquery1 proc sql feedback;2 select * from merge_a a3 where fli... 阅读全文

posted @ 2013-03-05 16:15 colipso 阅读(1447) 评论(0) 推荐(0) 编辑

【sas Notel】merge

摘要: 1 data merge_a; 2 input flight $ supervisor $; 3 datalines; 4 145 kang 5 150 miller 6 155 evanko 7 160 yale 8 ; 9 run;10 data merge_b;11 input flight $ destination $;12 datalines;13 145 brussels14 150 paris15 155 honolulu16 ;17 run;18 data merged;19 merge merge_a merge_b;20 ... 阅读全文

posted @ 2013-03-05 15:53 colipso 阅读(286) 评论(0) 推荐(0) 编辑

【sas proc sql】coalesce

摘要: 1 data mylearn.coalesce; 2 input a $ 1-1 b $ 3-3; 3 datalines; 4 a e 5 b 6 c f 7 d g 8 h 9 ;10 run;11 proc sql feedback;12 select coalesce(a,b) from mylearn.coalesce;13 quit;14 proc print data=mylearn.coalesce;15 run;coalesce函数返回参数里面的第一个非空值。 阅读全文

posted @ 2013-03-05 11:17 colipso 阅读(1396) 评论(0) 推荐(0) 编辑

【sas proc sql】cross/union/natural join

摘要: 1 proc sql;2 select a.a '#a#a sample',b.a from mylearn.outerjoin_a a cross join mylearn.outjoin_b b;3 quit;cross join 做两个表的笛卡尔积 ,如果有筛选条件,用where1 proc sql;2 select a.a '#a#a sample',b.a from mylearn.outerjoin_a a union join mylearn.outjoin_b b;3 quit;union join 仅做两表合并。1 proc sql;2 sel 阅读全文

posted @ 2013-03-05 10:02 colipso 阅读(1016) 评论(0) 推荐(0) 编辑

【sas proc sql】out join

摘要: 1 data mylearn.outerjoin_a; 2 input a :$; 3 datalines; 4 a 5 b 6 c 7 d 8 e 9 f10 g11 ;12 run;13 data mylearn.outjoin_b;14 input b :$;15 datalines;16 b17 c18 d19 k20 ;21 run;22 proc sql;23 select * from mylearn.outerjoin_a a rig... 阅读全文

posted @ 2013-03-05 09:33 colipso 阅读(1080) 评论(0) 推荐(0) 编辑

导航