SAS Base Programmer 練習問題24
capacity | airplanetype | staff |
---|---|---|
150 | Large | 10 |
A.
data work.test capacity = 150; if 100 le capacity le 200 then airplanetype = 'Large' and staff = 10; else airplanetype = 'Small' and staff = 5; run;
B.
data work.test; capacity = 150; if 100 le capacity le 200 then do; airplanetype = 'Large'; staff= 10; end; else do; airplanetype = 'Small'; staff = 5; end; run;
C.
data work.test; capacity = 150; if 100 le capacity le 200 then do; airplanetype = 'Large'; staff = 10; else do; airplanetype = 'Small'; staff = 5; end; run;
D.
data work.test;D.data work.test; capacity = 150; if 100 le capacity le 200 then; airplanetype = 'Small'; staff = 5; else; airplanetype = 'Large'; staff = 10; run;
出典はこちら
答え: B (要反転)
B以外はシンタックスエラーとなる。IF-ELSEブロック内で複数のステートメントを実行する場合はDO-ENDで括る必要がある。