proc print data=capacity (obs=4);
run;
data capacity;
modify capacity;
CapEcon = int(CapEcon .95);
CapBusiness = int(CapBusiness .90);
run;
proc print data=capacity (obs=4);
run;
proc print data=capacity(obs=5);
run;
data capacity;
modify capacity sasuser.newrtnum;
by flightid;
run;
proc print data=capacity(obs=5);
run;
modify capacity sasuser.newrtnum;
구문에서 capacity가 master 데이터 셋
sasuser.newrtnum가 transaction 데이터 셋
master data set is updated by matching values of the variable FlightID!!
Route ID가 transaction data set에 존재하는 flightID에 해당하는 값으로 바뀌어서 modify됨을 확인!!
Transaction에서 duplicate의 값이 있는 경우 마지막 값을 master 데이터 셋에 update해 줌
cargo99가 master data고 sasuser.newcgnum이 transaction
newcgnum의 세 variables들 값들로 master data set 업데이트 됨
key=변수이름, index 지정 옵션 (by 와 다르게 진행됨)
key=a 로 지정하였으나, 양쪽에 매칭이 되지 않는 경우에는 error 발생!!!
이러한 경우에는 /unique 옵션을 사용해서 error를 막을 수 있음:)
MODIFY SAS-data-set KEY=index-name /UNIQUE;
Primary key: assigning the NOT NULL and UNIQUE constraints
primary key와 check의 사용!! (문법 잘 확인)
check(where=~~) 이런 형식
• The PRIMARY KEY constraint is placed on the RouteID variable. This constraint
ensures that when values of RouteID are updated, they must be unique and nonmissing.
• The CHECK constraint uses the WHERE expression to ensure that the only values of CapBusiness that are allowed are those greater than Cap1st or missing.
proc datasets nolist;
audit capinfo;
initiate;
quit;
genmax 옵션 (genmax=n)
If the data set already exists, you can use the GENMAX= option with the DATASETS procedure and the MODIFY statement
• n=0, no historical versions are kept (this is the default).
• n>0, the specified number of versions of the file that are are kept. The number includes
the base version.