SAS Advanced programming 정리- SAS programming (13)

Hoya Jaeho Lee·2022년 6월 16일
0

SAS Advanced programming

목록 보기
13/17


Chapter 13 - Creating Indexes

기본 simple index 형식 (1)
data simple (index=(division));
set sasuser.empdata;
run;

기본 simple index 형식 (2)
data simple2 (index=(division empid/unique));
set sasuser.empdata;
run;

a composite index 형식 (Concatenated values of the Division variable and the EmpID variable)
data composite (index=(Empdiv=(division empid)));
set sasuser.empdata;
run;

proc datasets library=sasuser nolist;
modify sale2000;
index delete origin;
index create flightid;
index create Fromto=(origin dest);
quit;

코드 해설
Deletes the Origin index from the Sasuser.Sale2000 data set,
and creates two new indexes on the Sasuser.Sale2000 data set. FlightID is a simple index that is based on the values of the key variable FlightID.
Fromto is a composite index that
is based on the concatenated values of the key variables Origin and Dest.

SQL에서의 Index

-Creates a simple index named Origin on the Sasuser.Sale2000
data set.
-The index is based on the values of the Origin column.

proc sql;
create index origin on sasuser.sale2000(origin);
quit;

-Creates a new index named Tofrom that is based on the
concatenation of the values from the columns Origin and Dest

proc sql;
drop index origin from sasuser.sale2000;
create index Tofrom
on sasuser.sale2000(origin, dest);
quit;

References
SAS Certification Prep Guide: Advanced Programming for SAS 9, Fourth Edition 4th Edition by SAS Institute

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

0개의 댓글