-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweek9_2.3(alter).sas
52 lines (43 loc) · 1.05 KB
/
week9_2.3(alter).sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*alter table*/
proc sql;
alter table table_name
add 컬럼 해당컬럼속성
drop 컬럼
modify 컬럼 (컬럼의 값이 아닌 속성 바꾸기);
quit;
/*Bonus와 Level컬럼 추가*/
proc sql;
alter table airline.payrollmaster
add Bonus num format = comma10.2
,Level char(3);
quit;
/*drop DestinationType*/
proc sql;
alter table airline.flightdelays
drop DestinationType;
quit;
/*modify attributes(len, informat, format, label) of cloumns*/
proc sql;
alter table airline.payrollmaster
modify Bonus num format=comma8.2
,Level char(1) label = 'Empolyee Level';
quit;
/*example- 내가 한거*/
proc sql;
alter table airline.payrollmaster
add Age
drop DateOfHire
modify DateOfBirth format = 'mmddyy10'd;
quit;
/*example- 정답*/
proc sql;
create table work.payrollmaster as
select *
from airline.payrollmaster;
alter table payrollmaster
add Age num /*Age라는 컬럼만 추가*/
modify DateOfBirth date format = mmddyy10.
drop DateOfHire;
update airline.payrollmaster
set Age = int((today()-DateOfBirth)/365.25); /*Age의 value를 추가*/
quit;