options ls=85 ps=65; *nodate nonumber;

title "SAS PCA of national track records of women";

 

data track;

  infile 'D:\T1-9.dat';

  input m100 m200 m400 m800 m1500 m3000 marathon country$;

run;

 

proc print data=track;

run;

 

title2 "Plot of raw data by m100 and m200";

%plotit(data=track,labelvar=country,plotvars=m100 m200, color=black, colors=blue);

run;

 

ods html file="sas83.html";

ods graphics on;

 

proc princomp data=track out=pctrack;

  *var m100 m200 m400 m800 m1500 m3000 marathon;

run;

 

ods graphics off;

ods html close;

 

proc sort data=pctrack;

  by prin1;

run;

 

proc print;

  id country;

  var prin1 prin2 m100 m200 m400 m800 m1500 m3000 marathon;

  title2 "Rankings by the 1st PC: Overall performance";

run;

 

proc sort data=pctrack;

  by prin2;

run;

 

proc print;

  id country;

  var prin1 prin2 m100 m200 m400 m800 m1500 m3000 marathon;

  title2 "Rankings by the 2nd PC: Short- vs long- range performance";

run;

 

title2 "Scatter plot of the first 2 principal components";

%plotit(data=pctrack, labelvar=country, plotvars=prin2 prin1, color=black, colors=blue);