/* -------------------------------------------------------------------------------- program: tetra1.sas purpose: This SAS program demonstrates factor analysis of tetrachoric correlation coefficients. Here the tetrachoric correlation matrix is read from an external file produced by another program. written: 14 august 2006 notes: user supplies information in first three program lines below -------------------------------------------------------------------------------- */ /***** Supply path and filename for raw data, and no. of vars. ******/ %let path = c:\sas\; %let file = matrix.txt; %let nvars = 5; * set output line width to 80 columns; options ls=80 ; * clear the Display Manager log and output ; dm 'clear output'; dm 'clear log'; title 'Factor Analysis of Tetrachoric Correlation Coefficients'; * ------------------------------------------------------ ; * Read a matrix of tetrachoric correlation coefficients ; * from a file and store as a SAS correlation data set ; * (refer to SAS manual under PROC CORR for details) ; * ------------------------------------------------------ ; data one (type=corr); length _name_ $4; * use values assigned to path and file above; infile "&path&file"; * in a SAS correlation data set, each matrix row ; * is preceded by the variables _type_ and _name_ ; _type_='corr'; * here we name the variables v1, v2, ... v ; _name_='v' || left(put(_n_, best.)); * input the data ; input v1-v&nvars; run;