SAS Advanced programming 정리- SAS programming (15)

Hoya Jaeho Lee·2022년 4월 25일
0

SAS Advanced programming

목록 보기
15/17
post-thumbnail

Combining Data Horizontally

Combining Data with the ARRAY Statement

data mylib.employeesnew;
array birthdates{1001:1004} _temporary
('01JAN1963'd
'08AUG1946'd '23MAR1950'd '17JUN1973'd);
set mylib.employees;
Birthdate=birthdates(IDnum);
run;


Execution of a DATA Step Match-Merge

data work.data3;
merge data1 data2;
by x;
run;


RENAME 옵션
rename= (code=dest)
=> code를 dest로 바꿈

Execution of a PROC SQL Join

proc sql;
create table work.data3 as
select *
from data1, data 2
where data1.x=data2.x;
quit;

Using an Index to Combine Data

iorc = 0 -> 에러가 없는 경우
prevent to unmatched data from being included in the output data set

Using a Transaction Data Set

교차 데이터 셋의 결합인 경우
data set의 update 구문 이용!!
master data가 앞이고 교차하고 싶은 결과 값의 데이터 셋이 나중에 나옴

proc sort data=mylib.empmaster;
by empid;
run;

proc sort data=mylib.empchanges;
by empid;
run;

data mylib.empmaster;
update mylib.empmaster mylib.empchanges;
by empid;

run;



update ~by 구문 적용 후의 데이터 셋

profile
Biostatistics researcher Github: https://github.com/hoyajhl

0개의 댓글