/* sas2.sas: suggested solution for sas 2 exercise */ /* Bjarne Kjær Ersbøll 2001-09-23 */ title1 'SAS 2 - suggested solution'; data E6 (type=cov); _type_='cov'; length _name_ $8.; input _name_ x1 x2 x3; cards; x1 6.8491 -5.1952 -1.5193 x2 -5.1952 6.8433 1.5384 x3 -1.5193 1.5384 2.3077 ; proc print data=E6; title2 'Print of data E6 - type is covariance matrix'; proc princomp data=E6 cov; title2 'Princomp of data E6 - type is covariance matrix'; proc princomp data=stat2.sundhed; var alder loebpuls maxpuls; title2 'Princomp of data sundhed'; data E11 (type=corr); _type_='corr'; length _name_ $8.; input _name_ c3a blaine styrke28; cards; c3a 1 0.192 -0.168 blaine 0.192 1 0.320 styrke28 -0.168 0.320 1 ; proc print; title2 'Print of data E11 - type is correlation matrix'; proc princomp data=E11; var c3a styrke28; partial blaine; title2 'Princomp of data E11 - type is correlation matrix'; title3 'Partial with blaine'; proc princomp data=stat2.sundhed; var alder loebpuls; partial maxpuls; title2 'Princomp of data sundhed'; title3 'Partial with maxpuls'; proc factor data=stat2.sundhed rotate=none all; title2 '(Principal) factor analysis of data sundhed'; proc factor data=stat2.sundhed nfactors=3 rotate=varimax all; title2 'Factor analysis of data sundhed - 3 factors retained, varimax rotation'; run;