(5)プロシージャを作る

A.平均を求める            MEAN

B.データを並べ替える  SORT

C.レポートを作る           PRINT

D.プロットの作成

          PLOT SMP05.SAS                                                             

 TITLE1 'SMP05.SAS グラフィック表示';
 OPTIONS LS=78 PS=35;
 DATA HTWT;
 INFILE 'c:\samp.dat';
   INPUT NAME $ SEX $ AGE HEIGHT WEIGHT ;
         WTKILO=WEIGHT*.45;
       IF AGE<40 THEN GROUP=1;
       IF AGE>=40 THEN GROUP=2;
 GOPTIONS GUNIT=PCT
      
HSIZE=10 IN VSIZE=7 IN
       FTEXT=ZAPF HTITLE=6 HTEXT=3 BORDER;
 PROC SORT DATA=HTWT OUT=SORTHTWT;
       BY WEIGHT;
 RUN;

 PROC GPLOT DATA=SORTHTWT;
       PLOT HEIGHT*WEIGHT / FRAME;
      
SYMBOL1 VALUE=DOT H=3 ;

       TITLE 'Plot of Hight versus Weight';
       TITLE2 H=4 'Using the GPLOT Procedure';
       RUN;
 QUIT;

E.度数を数える

        SMP11.SAS       FREQ                                                         

 TITLE1 'SMP11.SAS  度数分布';
 OPTIONS LS=78 PS=35;
 DATA HTWT;
 INFILE 'c:\samp.dat';
 INPUT NAME $ SEX $ AGE HEIGHT WEIGHT ;
 RUN;

 PROC FREQ DATA=HTWT;
       TABLES AGE;
 RUN;

F.クロス集計票

        SMP12.SAS       FREQ  TABLES                                                 

 TITLE1 'SMP12.SAS   クロス集計';
 OPTIONS LS=78 PS=35;
 DATA HTWT;
 INFILE 'c:\samp.dat';
 INPUT NAME $ SEX $ AGE HEIGHT WEIGHT ;
 RUN;

 PROC FREQ DATA=HTWT;
       TABLES SEX*AGE;
 RUN;

G.合計や平均を求める

MEANS

        SMP13.SAS  SMP14.SAS                                                         

 TITLE1 'SMP13.SAS 平均';
 OPTIONS LS=78 PS=35;
 DATA HTWT;
 INFILE 'c:\samp.dat';
 INPUT NAME $ SEX $ AGE HEIGHT WEIGHT ;
 RUN;
 PROC MEANS DATA=HTWT;
 RUN;

 TITLE1 'SMP14.SAS  分類別 平均';
 OPTIONS LS=78 PS=35;
 DATA HTWT;
 INFILE 'c:\samp.dat';
 INPUT NAME $ SEX $ AGE HEIGHT WEIGHT ;
 RUN;

 PROC SORT DATA=HTWT OUT=SORTHTWT;
       BY SEX;
 RUN;

 PROC MEANS DATA=SORTHTWT;
       BY SEX;
       VAR HEIGHT WEIGHT;
 RUN;

H.相関係数

        SMP15.SAS                                                                    

 TITLE1 'SMP15.SAS 相関係数';

 options PS=35 ls=78;
 data TAIKAKU;
 infile "c:\samp.dat";
 input ;
 INPUT NAME $ SEX $ AGE HEIGHT WEIGHT ;
 RUN;
 proc corr outp=chi;
 run;
 PROC PRINT DATA=CHI;
 RUN;