/* Lesson 15-03 */ /* File Name = les1503.sas 02/02/21 */ options nocenter linesize=78 pagesize=30; options locale='en_US'; /* options locale='ja_JP'; */ proc printto print = 'StatM20/les1503-Results.txt' new; ods listing gpath='StatM20/SAS_ODS15'; data gakusei; infile 'StatM20/StudAll20e.csv' firstobs=8 dlm=',' dsd missover encoding=sjis termstr=crlf; input sex $ shintyou taijyuu kyoui jitaku : $10. kodukai carryer $ tsuuwa; if shintyou='.' or taijyuu='.' or kyoui='.' then delete; if kyoui<60 then delete; if taijyuu>85 then delete; proc print data=gakusei(obs=5); run; proc means data=gakusei; run; proc fastclus data=gakusei out=out_clust maxclusters=2; var shintyou taijyuu kyoui; run; proc plot data=out_clust; plot shintyou*taijyuu=cluster; plot taijyuu*kyoui=cluster; plot kyoui*shintyou=cluster; run; proc print data=out_clust(obs=20); run; /* Output to text file */ data _null_; set out_clust; file 'StatM20/les1503-OutValue.txt'; put shintyou taijyuu kyoui cluster distance; run; /* Output to CSV file */ PROC EXPORT DATA=out_clust OUTFILE= "StatM20/les1503-OutCSV.csv" DBMS=CSV REPLACE; RUN;