Economics & Deeplearning

PROC SQL Tutorial 6 - inner join 본문

SAS/PROC SQL

PROC SQL Tutorial 6 - inner join

이슈카 2016. 1. 26. 14:55

inner join

 

두 테이블에서 같은 값을 가지는 변수만을 남김 변수명은 달라도 상관없음

 

proc sql;

select *

from one, two

where one.x = two.x;





data step으로 하는 법

 

data merged;

merge one two;

by x; run;

 

proc sql;

select one.x, a, b

from one, two

where one.x = two.x

order by x;



table alias를 이용할 수도 있음

 

proc sql;

select staffmaster.empid, lastname, firstname, jobcode

from sasuser.staffmaster, sasuser.payrollmaster

where staffmaster.empid=payrollmaster.empid;

 

대신

 

proc sql;

select s.empid, lastname, firstname, jobcode

from sasuser.staffmaster as s,

sasuser.payrollmaster as p

where s.empid = p.empid;


Comments