今回はTITLEステートメントについて解説します。
data data1;
番号="AAAAAA"; コード="02"; 金額=1999;
output;
番号="AAAAAA"; コード="05"; 金額=2000;
output;
番号="BBBBBB"; コード="06"; 金額=2400;
output;
番号="BBBBBB"; コード="04"; 金額=1300;
output;
番号="BBBBBB"; コード="05"; 金額=4000;
output;
番号="CCCCCC"; コード="05"; 金額=5555;
output;
run;
title "title statement" ;
proc print data=data1; run;
![](https://how-to-business.com/wp-content/uploads/2021/11/title1.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/title2.png)
- TITLEステートメントにより、「結果」にタイトルを付けられる。
/* titleのみ */
title "title statement" ;
![](https://how-to-business.com/wp-content/uploads/2021/11/442ce0b70105bd959f4dcd0688c7fcf4.png)
- titleステートメントにより、「結果」にタイトルを付けられる。
- titleステートメントだけでは表示されない→「結果」を表示するプロシージャと一緒に使う必要がある。
/* title means */
data data1;
番号="AAAAAA"; コード="02"; 金額=1999;
output;
番号="AAAAAA"; コード="05"; 金額=2000;
output;
番号="BBBBBB"; コード="06"; 金額=2400;
output;
番号="BBBBBB"; コード="04"; 金額=1300;
output;
番号="BBBBBB"; コード="05"; 金額=4000;
output;
番号="CCCCCC"; コード="05"; 金額=5555;
output;
run;
proc sort data=data1 out=data2; by 番号; run;
title "title statement" ;
proc means data=data2 MEDIAN; var 金額; class 番号; output out=data3; run;
![](https://how-to-business.com/wp-content/uploads/2021/11/title-means1.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/title-means2.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/title-means3.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/title-means4.png)
- titleステートメントにより、「結果」にタイトルを付けられる。
- 「結果」を表示するプロシージャと一緒に使う必要がある。
- meansプロシージャでもタイトルは表示できる。
/* title2つ */
data data1;
番号="AAAAAA"; コード="02"; 金額=1999;
output;
番号="AAAAAA"; コード="05"; 金額=2000;
output;
番号="BBBBBB"; コード="06"; 金額=2400;
output;
番号="BBBBBB"; コード="04"; 金額=1300;
output;
番号="BBBBBB"; コード="05"; 金額=4000;
output;
番号="CCCCCC"; コード="05"; 金額=5555;
output;
run;
title "title statement" ;
proc print data=data1; run;
title "title statement" ;
proc means data=data2 MEDIAN; var 金額; class 番号; output out=data3; run;
![](https://how-to-business.com/wp-content/uploads/2021/11/364530561115229bce198fc961208ee4.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/2436147f3fdc4b447c6e15d1649c62a9.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/3735a24b0b15c1b9a629000c5934db42.png)
- titleステートメントにより、「結果」にタイトルを付けられる。
- 「結果」を表示するプロシージャと一緒に使う必要がある。
- titleステートメントが”「結果」を表示するプロシージャ”に掛かっている限り、複数でもタイトルが付く。
/* title改行 */
data data1;
番号="AAAAAA"; コード="02"; 金額=1999;
output;
番号="AAAAAA"; コード="05"; 金額=2000;
output;
番号="BBBBBB"; コード="06"; 金額=2400;
output;
番号="BBBBBB"; コード="04"; 金額=1300;
output;
番号="BBBBBB"; コード="05"; 金額=4000;
output;
番号="CCCCCC"; コード="05"; 金額=5555;
output;
run;
title "title statement
second line" ;
proc print data=data1; run;
![](https://how-to-business.com/wp-content/uploads/2021/11/3170d511218999c51c2ad13ea366653f.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/382d9a89d8f0ec9a6ec5d2b7aedffab5.png)
- titleステートメントにより、「結果」にタイトルを付けられる。
- 「結果」を表示するプロシージャと一緒に使う必要がある。
- titleステートメントを改行させて書いても「結果」では改行されずに、繋がって表示される。
/* title連続 */
data data1;
番号="AAAAAA"; コード="02"; 金額=1999;
output;
番号="AAAAAA"; コード="05"; 金額=2000;
output;
番号="BBBBBB"; コード="06"; 金額=2400;
output;
番号="BBBBBB"; コード="04"; 金額=1300;
output;
番号="BBBBBB"; コード="05"; 金額=4000;
output;
番号="CCCCCC"; コード="05"; 金額=5555;
output;
run;
title "title statement" ;
proc print data=data1; run;
title "title statement" ;
title "title statement2" ;
proc means data=data1 MEDIAN; var 金額; class 番号; output out=data2; run;
![](https://how-to-business.com/wp-content/uploads/2021/11/11880664c0bc55fff281148d6fa48ce3.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/e458c1ad7a489f0399b835b0609d1f79.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/61cb7d236c394e651b2ad7a1a508e759.png)
- titleステートメントにより、「結果」にタイトルを付けられる。
- 「結果」を表示するプロシージャと一緒に使う必要がある。
- titleステートメントが複数ある場合、最後のタイトルが表示される。
/* title2 */
data data1;
番号="AAAAAA"; コード="02"; 金額=1999;
output;
番号="AAAAAA"; コード="05"; 金額=2000;
output;
番号="BBBBBB"; コード="06"; 金額=2400;
output;
番号="BBBBBB"; コード="04"; 金額=1300;
output;
番号="BBBBBB"; コード="05"; 金額=4000;
output;
番号="CCCCCC"; コード="05"; 金額=5555;
output;
run;
title "title statement" ;
proc print data=data1; run;
title "title statement" ;
title2 "title statement2" ;
proc means data=data1 MEDIAN; var 金額; class 番号; output out=data2; run;
![](https://how-to-business.com/wp-content/uploads/2021/11/title2-1.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/title2-2.png)
![](https://how-to-business.com/wp-content/uploads/2021/11/title2-3.png)
- titleステートメントにより、「結果」にタイトルを付けられる。
- 「結果」を表示するプロシージャと一緒に使う必要がある。
- titleステートメントが複数ある場合、「title」「title2」とすれば複数のタイトルが表示される。